Closed collegeimprovements closed 6 years ago
Hey @collegeimprovements, I think if you read the two readme's you can get a pretty good sense of where the libraries differ, so I won't go over all of those again. But a few big differences in principles/goals that may be less obvious:
Conventional API. react-values
is designed around the native JavaScript types, and is able to use the exact same methods that the native objects provide, which is more consistent and memorable, so you're reading the docs less. This isn't true of react-powerplug
, with its subjective naming schemes, which result in more docs reading.
Composable primitives. react-values
also follows React's conventions around things like value/defaultValue
and onChange
. This isn't only for making things easier to guess, but also because it makes building complex behaviors that is necessary for UI components much simpler, so you don't have to rewrite this logic all the time. This isn't true of react-powerplug
, which means you have to re-write more of this logic yourself.
Simple state. react-values
is designed to help you remove the idea of "state management" from your codebase, by making it super simple to keep track of simple values. This is especially true with its concept of "connected" values, which stay in sync across your app's render tree. This isn't something react-powerplug
handles, and might not ever, because it may be considered out of scope.
Clear goal. react-values
has a specific goal which it is designed to solve, which means its API can more easily be considered "finished", and it can sooner be a bug-free building block. Which makes it easier to depend on and maintain over time. Whereas react-powerplug
isn't as well defined, meaning it's unclear how it will grow/shrink/change over time.
There are probably other differences. There are absolutely things that you can do out of the box with react-powerplug
right now that you cannot do with react-values
out of the box. But I think the approach of providing simple primitives that you can use to build more complex behaviors is the most flexible solution. And it lets you build your own custom helpers for more advanced logic whenever you need.
How is it different from
react-powerplug
? What are the pros of usingreact-values
overreact-powerplug
?