'React, separating fetch call and setting state, invalid hooks
I am experimenting with separating a fetch call into its own component. I am not concerned with whether or not this is best practice, I'm trying it as a learning experience.
My separated fetch call is here. I've shown it two different ways and commented what the error is. One attempt gives me an "invalid hook call" warning, which I understand. The other attempt does not set state. My main focus is here - I can not figure out where to place the state hook. My state manager Jotai is set up correctly.
I am attempting to import this fetch call into this file.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
