Reduxing redux…

This is getting confusing… But I will keep going.

this.props.registerUser(newUser);
This calls the Auth action imported:
import { connect } from 'react-redux';</div>
<div>import { registerUser } from '../../actions/authActions';
That action takes a parameter to register, and loads a dispatch, still a test in this case:
import { TEST_DISPATCH } from './types';</div> <blockquote> <div>/* Register */</div> <div>export const registerUser = userData => {</div> <div>  return {</div> <div>    type:'TEST_DISPATCH',</div> <div>    payload:userData,</div> <div>  };</div> <div>};
The action file is a collection of functions.
  • UI sends a user registration
  • The action file executes the Axios function. Action takes the current state tree and an action to be executed
  • When the Axios function returns it sends its result to the Reducer
  • The Reducer makes a copy of the state and saves to the Store
  • Store updates the state and remounts the render()

I will eventually understand how to apply this. But by the moment it does feel it is an overcomplicated way to flow data.

Leave a Reply

Your email address will not be published. Required fields are marked *