I always enjoy from Wes's courses and therefore I wanted to do his Redux course.
This is my attempt to do the course with Create React App and with updated dependencies.
The updated dependencies:
"react-scripts": "3.0.1",
"react": "^16.8.6",
"react-dom": "^16.8.6",
"redux": "^4.0.1",
"react-redux": "^7.1.0",
New dependencies that replaced some of the deprecated ones:
"react-router-dom": "^5.0.1",
"history": "^4.9.0",
"connected-react-router": "^6.5.0",
"react-transition-group": "^4.2.1",
The reduxstagram.js was split between src/index.js
(for the hot reloading configuration) and to src/Reduxstagram.js
(most of the reduxstagram.js original code).
-
I used the styles
package.json
scripts configuration from Wes React-For-Beginners course package.json. -
In the components I used arrow functions instead of binding.
-
The
src/Main.js
component now only displays the app title. -
The hot reloading is from this article: "Hot reloading with create-react-app without ejecting" by Brian Han.
-
- Use Connected React Router instead of react-router-redux which is deprecated and not working with React Router v4+.
- I used this basic code example.
-
Connect the store state and dispatch functions to the components:
I couldn't think of a way to make one file with the redux connect code such as in the original code (the App component). Mainly because I don't use the
{React.cloneElement(this.props.children, this.props)}
. From my understanding, I couldn't use it because React Router v4+ doesn't work with children components and therefore I couldn't pass the store props as in the original code.In the end, I create one file to handle the redux connect:
src/utils/reactReduxConnect.js
, such as App in the original code, however, I still need to use it in any of the components that need to use the store. -
Use react-transition-group instead of React-addons-css-transition-group as in Wes React-For-Beginners course.
-
In the
src/components/Comments
component, in order to get the input values, I replaced the all refs (excluding the one for the form) to state and onChange function. -
For Redux devtools extension I used the updated advanced store setup.
-
I left the Sentry configuration (
src/data/config.js
andsrc/Reduxstagram.js
) as is because I didn't want to change it from the original source/video, however, the API had been updated since then, for more information about it: "Switching to Sentry-Javascript".
- Not having the exact file/structure.
- One file
src/reduxstagram.js
(can't renamedsrc/index.js
without eject, and also I needed two files for the hot reloading). - Don't have one file with the redux connect code such as in the original code (the App component).
- Probably more things that I missed.