kailash yogeshwar kailash yogeshwar - 1 month ago 19
React JSX Question

How to structure React App with all Login Signup and home page with api calls too

So far i have followed the egghead io tutorials where only a handful of components where created in single App.js and which were rendered in main.js or App.js itself and with only one index.html

+= Project
├── App.js
├── main.js
├── node_modules
└── index.html


How would i create a folder structure for example like Login Signup home page and the use api server differently and keeping client in React JS.

How would component in signup page be rendered like Login Page will have Login Component and sigup page will have different component will that be rendered all in one main.js only and what about html files will they be different for signup login and home page .

A quick example would be much appreciated.

Answer

You'll find a good example on react-redux-universal-hot-example github repository.

In the login demo page, you can try to log in.

In source files, you'll find:

This exemple requires to understand Redux(Flux) and react-router, that you'll have to use/understand anyway if you want to continue with React (personal point of view ^^)

Regards