Introducing Redux (or similar state management) #190
Replies: 12 comments 22 replies
-
Hi @oze4 , I already thought about this a lot actually. But there are a lot of things to consider and how we manage it. But a better approach may be using formik with context maybe. This would be awesome because we don't need to write update error and touched logic. But this comes with one big if, we would need to make sure that data and columns are memorized to update. This would allow us to track when the data changes and to track this reasonably, useMemo or similar stuff is needed. Just like react -table does it. But this would be a big breaking change |
Beta Was this translation helpful? Give feedback.
-
@Domino987 I've been checking out Zustand today and I'm a big fan! I really like it. |
Beta Was this translation helpful? Give feedback.
-
I like zustand as well. Did you take a look at formik? It opens a local context for display and updating. This would also remove the need of updating values in itself, so the edit functions would be a lot easier as well. Ia grre with you tha we nned to remove the prop drilling and the 100238427 props passed to body. In addition to some management, composition would improve the code as well:
but instead
Formik with React.memo should work like a charm. Regarding the dnd. ITs super clunky and bloatd. I am thinkout about removing it in favor for somehting smaller/simpler. Maybe https://github.com/react-dnd/react-dnd/ |
Beta Was this translation helpful? Give feedback.
-
@Domino987 overall my thoughts are this...It doesn't really matter to me what we use - I just want to use something lol. Global state will make so many things so much easier. Specifically, separating props from state (this concept is HUGE). Here's my preferences:
With that being said, if you want to use Formik then let's start using it. Thoughts? |
Beta Was this translation helpful? Give feedback.
-
Looking at this from bundle phone, i think we should try to reduce the package size if possible. |
Beta Was this translation helpful? Give feedback.
-
Or we get rid of beautiful DND and react in one move, use a smaller DND lib and use Zustand for our use case? Using a custom date pickers is a great idea. So we get rid of beautiful DND and see where this leads us 👍 |
Beta Was this translation helpful? Give feedback.
-
Can we create a new branch and start working on it? |
Beta Was this translation helpful? Give feedback.
-
I started a sandbox on how we could remove beatifull dnd: https://codesandbox.io/s/react-dragtastic-example-forked-ksicx?file=/index.js WE just need the sorting and we should be able to get it going. |
Beta Was this translation helpful? Give feedback.
-
@oze4 something like this? |
Beta Was this translation helpful? Give feedback.
-
Moving my comments from the other thread.
At the library level, we should use the simplest solution that meets our needs. Refactoring this project to redux would take effort; it would take even more work later to refactor out of it. The decision to use redux should be at the app-level, not the library level IMHO. This library isn't as complicated as a full application so it's hard to justify the added complexity and weight of redux. By adding redux as a core dependency, this library becomes blocked by bugs in redux. |
Beta Was this translation helpful? Give feedback.
-
Hookstate is another state management tool that came across my feed. Not advocating for it, just adding it to the list in case it offers something we need. Unpacked size looks comparable to Redux (not sure how much smaller it is tree-shaken and gzipped). |
Beta Was this translation helpful? Give feedback.
-
@peacechen @Domino987 I went ahead and started to integrate context... The The main areas of concern: store, and using the provider. Thoughts? Keep in mind it is just the start.. I wanted to see what you thought about the structure, etc.. or get any input you may have. |
Beta Was this translation helpful? Give feedback.
-
Hey @Domino987 what are your thoughts on introducing Redux?
Beta Was this translation helpful? Give feedback.
All reactions