0
votes

I'm trying to create a React Redux application by extending the Redux Minimal boilerplate: https://redux-minimal.js.org/

This boiler-plate currently manages a list of users. I'd like to extend it to have another page that manages a 2nd type of item (in my example it is sports players), to help with my understanding. Does anyone have an example of a simple extension to this boilerplate, or can advise on the general approach of how to extend it in this manner?

Actions I've taken so far:

  • api - create a second API file of players.js, identical to users.js but returning an array of players
  • reducers/ - added a second reducer of players.js identical to users.js but with variable and constant names changed throughout
  • reducers/index.js added import for my players reducer. Added players: players at end of reducer after users: users, [wasn't sure about this]
  • sagas/ - added a second saga of players, which calls the players api above and with variable and constant names changed throughout
  • sagas/index.js - added import for players sagas and added corresponding sagas to function
  • router - added route for my player component
  • components/common - added copies of the various User... files with Player... files with variable names changed throughout
  • components/App.js - fairly unsure about this one. I've added a props.dispatch to call my PLAYERS_FETCH_LIST in the componentWillMount() as I assume they need to be loaded in at application start, but I was unsure if this should only be being called when the player component route is accessed, and added to the state at this point. Added players to the mapStateToProps to be returned.
  • components/Player.js - new page which calls the PlayerList component
1

1 Answers

0
votes

If you are new to learning React,

A) You dont have to learn/use Redux if you dont need it (yet), its intentionally complicated, and you will figure out how to use it when you need to use it. React has a built-in state system, and it is recommended to start with it, and lift the state up when you need to share it between your components.

B) If you still want to learn Redux, leave the redux-sagas alone for the time being, its definitely not a requirement with redux, specially if you are still learning redux it self.

So, if I were you i'd ditch the redux-minimal and find a good tutorial that leads you through redux basics (only after you are confident about your React knowledge)