5 ms·
Redux is the only thing (sort of) from the React ecosystem that I'd save from a fire. But mine seems to be a minority opinion.
by brimble 4y ago
Redux is the only thing (sort of) from the React ecosystem that I'd save from a fire. But mine seems to be a minority opinion.
- oblak 4y agoRedux is largely responsible for turning me away from React sending me straight into Vue and Vuex.
- yourad_io 4y agoIf you ever have to go back to react, take a look at mobx It is very uncomplicated
- aabbcc1241 4y agoIMO mobx has better DX than redux, not sure why it's less popular. Probably because react community prefer FP over OOP?
- tcoff91 4y agoSome graphQL clients can eliminate the need for these state management tools. Everything becomes just graphQL queries and mutations with very sophisticated caching. When you mutate some resource, other components that have queries that are affected by the mutation will re render with the new state.
- acemarke 4y agoI'm sorry to hear that :( For what it's worth, we've changed Redux usage drastically in the last three years. "Modern Redux" with Redux Toolkit and React-Redux hooks is drastically simpler to learn and use than the older-style patterns, and we get feedback from users on a daily basis telling us how much they enjoy using RTK. If you're curious to see what that looks like, I did a video discussing the changes and cooperatively live-coding an example app: https://redux.js.org/tutorials/index#learn-modern-redux-livestream https://redux.js.org/tutorials/index#learn-modern-redux-live... and the "Redux Essentials" tutorial in our docs shows how we want people to learn and use Redux today: https://redux.js.org/tutorials/essentials/part-2-app-structure https://redux.js.org/tutorials/essentials/part-2-app-structu...
- driton 4y agoFor what it's worth, I gave RTK a go after a rushed, failed attempt at using redux. Initially started as a POC for some internal tooling within the company. Due to its simplicity, it was a breeze to set up. Two years later, it's still great, and things like RTK Query[0] have made it even better, by removing the need to write custom data fetching logic, and adding other perks like caching. Thank a lot for your hard work! [0] https://redux-toolkit.js.org/rtk-query/overview https://redux-toolkit.js.org/rtk-query/overview
- acemarke 4y agoThank you! Great to hear that it's working well for you.
- Hackbraten 4y agoYour second link briefly got my hopes up that I’d finally be able to learn a little about Redux today. Nope, the tutorial tells me I better get good first in: > React terminology: JSX, State, Function Components, Props, and Hooks Does that imply you can’t use Redux without React at all? Or does it just use part of React’s concepts? I’d totally love to learn to manage my application state better. Do I really have to pull React in with that? I use vanilla JS as much as I can because I want my apps to have a decent chance to still be working a decade from now.
- brimble 4y ago> Does that imply you can’t use Redux without React at all? Yikes, I hope not. One of my favorite things about Redux (last time I used it, maybe three years ago) was that it was easy, and even natural, to build an API client library around it that could be used almost anywhere that JS will run, because it wasn't tied to React.
- acemarke 4y agoNo worries :) Non-React usage is still the minority use case, but it's one that we take seriously. Per my comment above, Redux and Redux Toolkit are still 100% UI-agnostic at their core. Even our new "RTK Query" data fetching API in RTK works with (or without!) any UI, which is why users have adapted it to run alongside NgRx, Vue, and Svelte.
- presentation 4y agoI don't get why most projects need Redux when React has the context API already. Most people just need a place to store data shared across different components, and plain contexts do that easily.
- skydhash 4y agoThey can, but for any reasonable sized application, you're basically recreating bare redux. If someone is good with both, it can architect and choses the correct one based on the needs of your software. But if you find that your global state needs are not small, you just chose redux - add a library like rematch on top to reduce boilerplate - so it's straightforward for your junior.
- acemarke 4y agoOut of curiosity, any particular reason you'd suggest Rematch instead of our official Redux Toolkit package? If you're familiar with both already, are there any parts of Rematch's API you prefer over RTK's, that we should consider looking at for inspiration?
- acemarke 4y agoBecause Redux and Context are different tools that solve different problems, with some overlap. Context is a Dependency Injection tool for a single value. Note that it doesn't "manage" or "store" anything - it's just a tube that you can pass something through. Any actual "storage" is normally done with React's own `useState/useReducer` hooks, which actually _do_ store and update values. Redux, meanwhile, is a tool for predictable state management outside React. Very different kind of tool, for a different purpose. More details: https://blog.isquaredsoftware.com/2021/01/context-redux-differences/ https://blog.isquaredsoftware.com/2021/01/context-redux-diff...
- deleted 4y ago[deleted]
- jokethrowaway 4y ago
- jokethrowaway 4y agoRedux historically had a pretty terrible API. Next stop: Boilerplate-ville. But it's based on a sound model. Go and check out elm, the project redux copied its structure from and you'll see what that model is capable of achieving in a decent language. Today with hooks Redux is not too bad but still subpar. I used for years my own simplified store, these days I just use zustand.