Part 7 of FSO is about custom hooks and other extra bits.

Custom Hooks

WIP

Custom hooks don’t share states between calls

Creating a custom hook with state within it, each time the hook is called like so:

const { count, setCount } = useCounter()

It will create a new instance of the state. Which means declaring it in two files, but then using setCount in the second file will not update the state in the first one, as they are two different instances.


Previous Post Next Post