Buy Now and unlock this series
$
49
.99
$
24
.99
yours forever
$
49
.99
$
24
.99
Become a Pro and unlock everything
$
24
.99
per month
$
24
.99
Controlling useEffect
Downloads
Become a pro to download code and videos
React Hooks For Everyone
22 videos
Course Instructor
Scott Tolinski
- Series Introduction
42S - What Are React Hooks?
3M44S - Project Setup
3M54S - useState
8M19S - Refactoring A Class Component
8M5S - useState Part 2
6M40S - useEffect
6M35S - Creating Custom Hooks
6M41S - Use Refs with useRef
6M21S - Context With Hooks
7M54S - Advanced State Management With useReducer
10M49S - useMemo For Expensive Functions
9M34S - useDebugValue For Custom Hook Libraries
5M36S - Fetching Data With useEffect
12M20S - Controlling useEffect
4M11S - Controlling useEffect Part 2
6M21S - useLayoutEffect To Wait For DOM
10M24S - What Is Cleanup
6M26S - More Complex Custom Hooks
15M25S - 3rd Party Hooks
5M24S - Basic Animation With React Spring
5M55S - Where To Go From Here
3M29S
Comments
Raul
almost 2 years ago [edited]
@question Yes, useMemo will work for the provided example. However, it could be argued if it's a correct use semantically speaking.
question
almost 2 years ago
could u use a useMemo?
Raul
about 2 years ago [edited]
@Cris Maybe the site was blocking temporarily. I've just tested it and it seems to work fine. Let us know if it's still happening
Steven
over 2 years ago
This is incredible, I've loved this series so much.
Cris
almost 3 years ago
I am having issues calling the api.
Access to fetch at 'https://my-json-server.typicode.com/leveluptuts/fakeapi/dishes' from origin 'http://localhost:3000' has been blocked by CORS policy: The 'Access-Control-Allow-Origin' header has a value 'https://localhost:3000' that is not equal to the supplied origin. Have the server send the header with a valid value, or, if an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.
I try to set the mode to no-cors but doesnt seem to be working
Amber
about 3 years ago
Technically, shouldn't "fetchDishes" be passed in the dependency array? This does cause a constant call since it is redefined for each render. But I feel like omitting it is a bad practice since there is no guarantee that "fetchDishes" value will never change.
Want to join the conversation?
Become a Pro member today!