3 ms·
What ? How can redux be replaced by graphql ? How would you handle multi form pages where you have to maintain state ?
by cryptozeus 8y ago
What ? How can redux be replaced by graphql ? How would you handle multi form pages where you have to maintain state ?
- k_ 8y agoTurns out apollo (graphql client for react) is doing more or less redux's work. I planned on using both at first when I started migrating to graphql, but quickly saw that indeed redux was becoming redundant when we use apollo. Especially since they added local state management [1]. [1]: https://www.apollographql.com/docs/react/essentials/local-state.html https://www.apollographql.com/docs/react/essentials/local-st...
- disiplus 8y agobut you could do this anyway without redux, i had a simple CRUD react app that did its own requests on componentmount and thats all, you dont need redux allways, maybe people are just starting to discover that.
- maaaats 8y agoYeah, often you don't need it. But in this case, what if that state was to be used different places in your app? (Excluding direct descendants where you could easily pass it as props)
- kalia 8y agoThere is probably half a dozen way of maintaining state to handle multi-form pages without Redux and GraphQL (both on client-side or server-side, or a combination of both). I guess one of the point the author was trying to make is that using GraphQL makes it easier to handle the state on the server, and it has multiple advantages (what if you fill a form half-way through on your desktop and want to resume on another device). GraphQL also makes Http requests "cheaper", you only ask for what you need and reduce payloads in general.
- cryptozeus 8y agoRight, but you don't always want to or need to go to server to maintain state.