fullstackopen | Exercises for the Full Stack Open course | GraphQL library
kandi X-RAY | fullstackopen Summary
kandi X-RAY | fullstackopen Summary
Frontend for the patientor project in round 9 is hosted here.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of fullstackopen
fullstackopen Key Features
fullstackopen Examples and Code Snippets
Community Discussions
Trending Discussions on fullstackopen
QUESTION
The try block is working fine and I get the response as intended. However, when I try to delete with an invalid Object ID, the catch block does not work as intended. I should be getting a json response in Postman but I get nothing.
Here's the route handler:
...ANSWER
Answered 2021-Apr-04 at 11:30You also need to put the first promise into try catch
QUESTION
I've sifted through a few questions answered already and learned quite a bit but I am stuck on a formatting issue.
With my components set up currently I am rendering this:
Half Stack application development
Node.js
- List item
- List item
- List item
- List item
- List item
This is what I am attempting to render.
Half Stack application development
- List item
- List item
- List item
Node.js
- List item
- List item
The data I am mapping
...ANSWER
Answered 2021-Mar-26 at 19:57You need to map through the courses and display the header inside the loop and then loop through the parts
QUESTION
I'm working through fullstackopen and i'm on exercise 1.13. I am struggling to understand how to implement a way to update the state for individual items in an array [anecdotes].
Each anecdote has is allowed a number of votes.
I can increment votes, but it increments votes for all.
https://fullstackopen.com/en/part1/a_more_complex_state_debugging_react_apps#exercises-1-6-1-14
The below code is what they provide as a hint to implement, as well as some hints about using arr.fill()
...ANSWER
Answered 2021-Mar-18 at 13:04Ok, so the issue is that you initialize the state(votes) with 0. Instead, you should initialize that with an array of zeros.
QUESTION
export const App2 =()=>{
const [counter,setCounter]=useState(0)
setTimeout(()=>setCounter(counter+1),1000)
return(
{counter}
{setCounter(counter+1)}}> Plus
)
}
...ANSWER
Answered 2020-Oct-30 at 03:10setTimeout
causes an effect, so we should put it inside a useEffect()
hook. Also, since setCounter depends on the previous counter state, we can pass an updater function to setCounter which receives the previous state value.
QUESTION
I have this app that adds "persons" to a "phonebook", and the user can update the person's phone if the person already exists. but I want to know to handle the problem of when the person was already deleted (i open two tabs and delete a phone in one tab, and I try to "update" it in the second tab)
I have a persons.js
which handles all HTTP requests (I'm using axios)
and a PersonNotification.js
which tell the user if the phone is "added" or "updated" or "doesn't exist anymore"
and all the main functionalities are inside the App.js
here is my code
persons.js
...ANSWER
Answered 2020-Oct-03 at 20:29This part should help you enough to go further.
persons.js
QUESTION
I cant for the life of my get one of my actions to call the reducer. I've written multiple other actions and reducers in this app, which works perfectly.
It is the beginning of a filter function. I have a text input field, where I constantly keep track of the input field state, and dispatch the field value to the redux action. I have a console.log inside the action, which logs every keypress properly.
What I cant seem to understand, is why the reducer isn't called at each keypress. I've tried multiple console.log's inside the reducer, however none of them gets logged with keypresses.
The first console.log inside the reducer is called when I refresh the page. if I try to log action.type instead, I get:
...ANSWER
Answered 2020-Jun-20 at 18:06Try to instantiate useDispatch like this after const [value, setValue] = useState("");
QUESTION
This is based on exercise 2.14 of this course https://fullstackopen.com/en/part2/getting_data_from_server.
The user can select a country, then the weather information for that country's capital will be dislpayed. My code gives me error Cannot read property 'temperature' of undefined
...ANSWER
Answered 2020-Jun-05 at 03:39weatherDetails
is an empty array, initially, so there is no current
property to read from.
Use some conditional rendering. Use initial null state and then check that it is truthy to access the rest of the object when it is updated.
QUESTION
I'm learning React (with hooks) and I encountered a weird issue. Im currently working on Notes Application (from FullStackOpen learn react). My database only accepts notes which content length is greater than 4 characters. In case of invalid note my server catches a ValidationError and returns an error message with status code 401 instead of new note. My goal is to catch this error in frontend and display an error message.
Backend code:
...ANSWER
Answered 2020-May-03 at 17:42Put the try, catch block around your api call:
QUESTION
I am working with React and I can't seem to define properly the state of a component (handlePoints). When I want to assign a new state using shallow copy it creates a new entry (key).
Apologies that part of the question is not in code. I couldn't edit it here. If you need more information please reach out. Thanks! I've added an image where you can see that there is a new entry added instead of a modification happening to an existing entry.
...ANSWER
Answered 2020-Feb-17 at 00:00In terms of why a new field with key 'selected' is being added, is due to how you are creating the new object. If you want to to update the key with the variable selected, you would need to modify the handlePoints function to be:
QUESTION
The handleSubmit() function is where I am preventing the user from adding an existing user but it does not work. If the name added exists in the persons list then an alert should pop up.
EDIT: Link to my code https://github.com/yudhiesh1997/fullstackopen/tree/master/part2/phonebook
...ANSWER
Answered 2020-Apr-17 at 08:30You need to determine if your user exists in array
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install fullstackopen
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page