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

Minor updates and author info improved #817

Merged
merged 1 commit into from
Oct 8, 2021
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion content/author.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
bio: Karl is a Software Developer at LoginRadius, the rapidly-expanding social login and sharing provider. He graduated from NAIT with a diploma in Computer Engineering Technologies. He enjoys snowboarding, watching TV series and gaming.

- id: Versha Gupta
bio: I am a software enthusiast and contributor interested in React JS, UI/UX, Tech Blog, Javascript, Node JS, DevOps.
bio: She is a software enthusiast, an avid contributor, and blogs regularly. She usually works with React, UI/UX, Javascript, Node.js, and DevOps.
github: "vershagupta"
stackoverflow: "1455329"
linkedin: "versha-gupta-4865b339"
Expand Down
4 changes: 2 additions & 2 deletions content/how-to-fix-memory-leaks-in-react/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ React components that perform state updates and run asynchronous operations can
2. After that, a user clicks on a link, which navigates to another page before completing step #1.
3. Now, the first action completes and passes the data retrieved from the API and calls function, which updates the state.

Since the component was unmounted and function is being called in a component that is no longer mounted, it causes memory leak issue -- and in the console, you'' get a warning.
Since the component was unmounted and function is being called in a component that is no longer mounted, it causes memory leak issue -- and in the console, you'll get a warning.

Example of unsafe code:

Expand Down Expand Up @@ -82,7 +82,7 @@ const [value, setValue] = useStateIfMounted('checking value...');
});
}, []);
```
In the above code, I've used a hook that works just like React's `useState`, but it also checks that component is mounted before updating the state!
In the above code, I've used a [hook](https://www.loginradius.com/blog/async/react-hooks-guide/) that works just like React's `useState`, but it also checks that component is mounted before updating the state!

## Conclusion

Expand Down