I've recently started using React and Redux and there 2 issues I can't quite resolve by my own.
- I've implemented login and registration forms, when searching for examples online I found a few examples where the typed username and password weren't processed using Redux, but instead were just stored in the component's state (as if the app was a pure React app, without Redux).
In my login form, I process everything through Redux with reducers and everything, was I wrong or was the random example wrong?
- Regarding Redux - let's take this reducer for example: https://gist.github.com/avrahams1/ea74cfa7a9361fdd55ad4bea9d59d07e (I couldn't get SO's code function to work :( ).
It's a reducer for a server call to a teachers API, getting all the teachers from the server. As you can see there are 4 states - not called, pending answer from server, success (with data), fail (with error).
My problem is - in each case I have to explicitly reset the other data, because otherwise once the "loading" flag is set to true it's never set to false, same for the error. Even when the data arrives my component gets stuck on "loading", am I doing something wrong here? How should I reset stuff like the loading and error fields otherwise?
Thanks, Avi.