loading...

re: Recoil - an experimental state management library for React apps open-sourced by Facebook VIEW POST

FULL DISCUSSION
 

Hey, Thank you for this library!
Maybe I didn't get this all sinked in.. I wonder how different this is from Redux + Reselect.
If I had to design this, what I would do is:

  • Items are updated in a redux reducers.
  • Container gets all the ids so it can render the items, but it doesn't pass them anything other than id
  • Each item is connected directly to its own state using a redux-connect + its own id passed through ownProps
  • The bounding box issue can be solved by saving all the selected boxes ids in redux, and having reselect selector compute the bounding box.
  • Constraint can be calculated in the reducer itself
  • And using a middleware we can listen to any changes including url, and update the state accordingly

If in fact my solution actually works, and I don't miss anything, I'm pretty sure, that at least for the boilerplate to set this up, this library can probably do it with much less code than redux, but I wonder if, other than that, this solution is more performant than the way I'd do it.

code of conduct - report abuse