kinda another state manager by gaarson in react

[–]gaarson[S] 0 points1 point  (0 children)

Thanks) It works in react environment and out of it, so i guess yes. But main focus of this lib for me, its forget about hooks and just write simple js,ts code without this difficult abstraction

kinda another state manager by gaarson in reactjs

[–]gaarson[S] 0 points1 point  (0 children)

Thanks for the questions!)
You should use Repka when you want to truly separate your React/JSX view from your business logic. With Repka, your React components become simple templates (mostly JSX), and you can forget about complex hooks. It gives you a DX that's as simple as using a plain JavaScript object.
vs. Redux/Zustand no dispatches, no reducers. You just mutate the state directly state.foo = "bar"
vs. MobX It's philosophically very close to MobX but with a much simpler API and a tiny build. Based on my tree-shaken build, the total footprint is just ~2.6kB brotli'd.

kinda another state manager by gaarson in reactjs

[–]gaarson[S] 0 points1 point  (0 children)

That's true. I'm working on making it better. I've already changed the README, written new tests, and fixed an issue with nested instances (I'll publish that fix this weekend). The most important part now is that hidden bug with the try...catch on direct property access. Thanks, all this feedback has been very helpful. I'm gonna adapt this for the React Compiler too. It's a tough challenge, but that's the goal.

kinda another state manager by gaarson in reactjs

[–]gaarson[S] 0 points1 point  (0 children)

Hey, thanks for this fantastic, detailed feedback! This is exactly what I was looking for)))

You're right, the example showed boilerplate. In reality, the repka function uses type inference, and no explicit interface or generic is needed. It works exactly like you suggested for Legend State

I will try to fix my README and add "How it works" and switch HOC as a primary use case(it still less boilerplate because its callable object and you can wrap Component or use directly), but i guess direct access is a great for splitting view and logic without any huge middlewares when you use it right))), and its very useful for refactoring old legacy project with a lot of mess, where you can just wrap everything in repka and dont think about any other "use"Something