card background pattern
Level 2

Custom React Hooks

Unlock Full Course

$49.99 $24.99

Or

$24.99/Month

A Basic Toggle Hook

We will start off looking at hooks by making a basic toggle using React hooks. We will use the useState hook to accomplish this.

Downloads

Comments

Raul
Admin
updated 3 days ago

@fpigeonjr Font is MonoLisa and theme Synthwave 84

fpigeonjr
3 months ago

Scott, what font and theme are you using? Looks great!

dave.js
4 months ago

@Daniel The intention is to avoid potential bugs when introducing async functionality into the component. Here's a section in the FAQs that gives an example of this: https://reactjs.org/docs/hooks-faq.html#why-am-i-seeing-stale-props-or-state-inside-my-function

Daniel
4 months ago

do you have a link to the recommendation of prevState over the state variable? i couldn't find it in the react docs where they just use the regular state variable

Ryan C. Perry
4 months ago

In the same VSCode package, RAFCE does the same thing with the default export at the bottom.

Something to say?

Become a Pro