|
|
|
|
|
by faefox
1099 days ago
|
|
> State in Svelte goes in stores. State in react seems to go in one of eighteen different mechanisms, which all begin with a 45 minute video of the author’s opinions about the true nature of reactive programming, when all I want to do is store a string. So... useState? :) Of course then I got to thinking about how I'd answer the question "How can I put make that useState value accessible at different points in the component tree?" and the answer was "Make a new context with createContext and wrap the context provider in a component which provides the state and write a hook to easily consume the context within a child component" and, yeah, that's not exactly a frictionless dev experience. FWIW for simple state management in React I've heard lots of good things about zustand: https://github.com/pmndrs/zustand |
|
It's really quite simple and elegant. Svelte's model would likely be more complex tbh.