Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace broken blog link with one to React docs #290

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions blog/react-usestate-callback/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ const App = () => {
export default App;
```

The function you pass to the useEffect hook is your callback function which runs after the provided state changes from the useState hook's second argument. If you perform changes in this callback function that should be reflected in your component's rendered output, you may want to use [useLayoutEffect instead of useEffect](/react-useeffect-vs-uselayouteffect/).
The function you pass to the useEffect hook is your callback function which runs after the provided state changes from the useState hook's second argument. If you perform changes in this callback function that should be reflected in your component's rendered output, you may want to use [useLayoutEffect instead of useEffect](https://beta.reactjs.org/reference/react/useLayoutEffect).

If you are looking for an out of the box solution, check out [this custom hook](https://github.com/the-road-to-learn-react/use-state-with-callback) that works like useState but accepts as second parameter as callback function:

Expand Down Expand Up @@ -125,4 +125,4 @@ const App = () => {
export default App;
```

This way, you can decide when to use the second argument for the callback function and you can decide for each case what the callback function should do specifically.
This way, you can decide when to use the second argument for the callback function and you can decide for each case what the callback function should do specifically.