قالب وردپرس درنا توس
Home / IOS Development / Set up React and Redux

Set up React and Redux



This post is the second part of an 8-part series that delves deep into how to build a robust, real-world frontend app data layer. See the previous sections here:

In this post we will set up the React / Redux app, which will serve as a basis for improvements to data layers in future posts. We also see some patterns for organizing components and Redux code that can be useful for production applications. Along the way, we are expanding our user interface using the material React Materialize for UI components. React Materialize is not required for any of the data content we come across, but it is needed to make this sample app something that will be nice to watch!

If you have a working knowledge of React and Redux, then all this should be known to you. If you have any uncertainty about something in this post, we recommend that you spend some time in React Docs or Redux Docs, so you get a good understanding of the basics of the app.

If you want, you can download the app as

Create a new app with create-react-app :

  $  save-respond-app respond-data-team

Next, let's set up the opportunity to import using absolute paths in the project. This will make it easier for us to have a deeper folder structure. To do this in an app create-react-app just add a .env file at the root of your project and define the following variable:

Let's also remove some of the standard content that comes with the app, so we can start with a clean slate. Delete the following files:

  • src / App.css
  • src / App.test.js
  • src / index.css
  • src / logo.svg

Then remove the reference to index .css from index.js :

   Import React from & # 39 ;;
import ReactDOM from & # 39; react domain & # 39 ;;
-import & # 39; ./ index.css & # 39 ;;
Import App from & # 39; ./ App & # 39 ;;
import * as a service author from & # 39; ./ serviceWorker & # 39 ;;
[1
9659000]] and replace the contents of src / App.js with the following:

  import    React    from    react & # 39; ; 

19659018] App = () => (
< div classname = "App" >
Hei world !
< / div >
);

export


Source link