13
Create React Hooks visually
Activity
Donald Hruska
Hey Arash, we're thinking about this one. Would love to hear more about what you specifically were trying to accomplish as we figure out what this would look like.
A
Arash Zolfaghari
Donald Hruska: Hi Donald! So for sake of simplicity let's say I want to setup states.
I'm thinking the outer shell would be where users add more global states and we can use the Recoil library. They would create their atoms and can later pull it in using the useRecoilState hook. Other users may have states internal to a given component in which case they could have useState hook defined and [myvar , setMyVar] = useState(initialValue) could be controlled visually as well as tied into that component (or passed down as a prop to the next component).
Another important hook, useEffect has zero (so only loads once) or more dependancies. This is useful for lets say fetching a variable and once completed updating the internal (or global) state of a component (using useState etc). We could also have multiple useEffects which are waiting on different changes to happen before getting triggered.
Just having the useRecoilState, useState and useEffect visually tied into our Draftbit components would save developers tons of time as well as helps them structure a clean architecture.