Why should you never call hooks inside a nested function in react?
Because hooks can only be called from the top level of a function component
To ensure that the component updates correctly
To avoid unnecessary re-renders of the component
To prevent memory leaks
True or false. The fetch function should be used inside the
componentDidMount
lifecycle method oruseEffect
hook.True
False
When you receive a HTTP response using the fetch() API, how do you parse the data into a JavaScript object?
The
fetch()
API automatically parses the response data as a JSON object.You should use the
text()
method of the response object to parse the data as a JSON objectYou should use the
json()
method of the response object to parse the data as a JSON object.You should use the
JSON.parse()
method to parse the response data as a JSON object.
Which of the following statements are true? Choose all that apply.
You can load local JSON files in your React project
The
fetch()
API call cannot make DELETE requestIf the external API returns JSON data, you need to exclusively parse it in the
fetch()
APIYou cannot make multiple
fetch()
calls in theuseEffect
hook
Complete the sentence: JSON is ______________.
Only a data exchange format
Only a file format
A file format and a data exchange format