First of all, thank you for the compliment. It matters to me a lot.
Now coming to the question. Context API actually works by creating a React Component, so doing asynchronous calls will be defining another function for that and calling that when required(Obviously you will need to pass that function with the component you are returning so that you can call it from the other components).
Hello , Ive stumbled upon your post while deciding upon context api or redux for a next js project , and a user from reddit said a year ago, "Context is actually not great as a Redux replacement, since every context consumer does re-render whenever any value in the context changes, while in Redux only those components must be rendered for which the selected data changed." , is this still true in 2020 . And what do you think about Apollo state vs state manager (redux , mobx , redux) . I am using Apollo graphql in my Nextjs client.
For a bigger level project, I would still suggest using Redux, as it is still now the industry standard. I don't exactly have the complete knowledge of the inner working of redux and context api, especially how they handle content rendering, so I can not enlighten you about that. At the end of the day, the technology you choose depends on two things - what your app needs and how much comfortable you are with that technology.
Thanks for replying , that seems clear to me now . context-api+usereducer is my default pick currently for state manager unless I need redux dev tools , the rendering rumor is still to be investigated by me.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
First of all, thank you for the compliment. It matters to me a lot.
Now coming to the question. Context API actually works by creating a React Component, so doing asynchronous calls will be defining another function for that and calling that when required(Obviously you will need to pass that function with the component you are returning so that you can call it from the other components).
Hello , Ive stumbled upon your post while deciding upon context api or redux for a next js project , and a user from reddit said a year ago, "Context is actually not great as a Redux replacement, since every context consumer does re-render whenever any value in the context changes, while in Redux only those components must be rendered for which the selected data changed." , is this still true in 2020 . And what do you think about Apollo state vs state manager (redux , mobx , redux) . I am using Apollo graphql in my Nextjs client.
For a bigger level project, I would still suggest using Redux, as it is still now the industry standard. I don't exactly have the complete knowledge of the inner working of redux and context api, especially how they handle content rendering, so I can not enlighten you about that. At the end of the day, the technology you choose depends on two things - what your app needs and how much comfortable you are with that technology.
Thanks for replying , that seems clear to me now . context-api+usereducer is my default pick currently for state manager unless I need redux dev tools , the rendering rumor is still to be investigated by me.