Home
Head's Up: I'm in the middle of upgrading my site. Most things are in place, but there are something missing and/or broken including image alt text. Please bear with me while I'm getting things fixed.

Lazy initializer for useState

jsx
const [thing, setThing] = useState(() => { some_expensive_operation ? 'yes' : 'no' })

If you pass a function as the argument to useState() it'll use that for the initial load and only call that when necessary instead of on each render

TODO : Confirm that code snippet