A create-react-app boilerplate that is bootstrapped using the ignite-react-app cli.
Currently includes:
When you’ve installed the Ignite React App, you can get started with this boilerplate like this:
ir-app new my-awesome-app
Your src
folder is where most of the goodies are found in an Ignite React App that was created using Create React App. Let’s walk through them in more detail. Start with src/index.js
(described below) and work your way down the walkthrough in order.
This boilerplate uses the methodology described here. Layout components are generally associated with the application routing and they take advantage of the Dynamic Routing concept of React Router v4.
To generate a new Layout you can use the following generator commands:
ir-app layout Products
This boilerplate makes use of the methodology discussed by Dan Abramov @dan_abramov/smart-and-dumb-components-7ca2f9a7c7d0">here. Containers are components that are concerned with how things work.
Container components:
To generate a new Container you can use the following generator commands:
ir-app container Comment
or
ir-app cont Comment
Again borrowing from Dan Abramov’s approach. Components are presentaional components and they are concerned with how things look.
To generate a new Component you can use the following generator commands:
ir-app component Comment
or
ir-app comp Comment
Storybook has been setup to show off components in the different states. Storybook is a great way to develop and test components outside of use in your app. Simply run npm run storybook
or yarn storybook
to get started. All stories are contained in the *.story.js
files along side the components.
Styling themes used throughout your app styles.
Colors.js
- defined colors for your appMetrics.js
- useful measurements of things like navBarHeightInitialize and configure things here.
ApiConfig.js
- simple api configuration hereAppConfig.js
- simple app configuration hereDevConfig.js
- define how you want your development environment to actReduxPersistConfig.js
- configures Redux PersistContains json files that mimic API responses for quicker development. These are used by the Services/FixtureApi.js
object to mock API responses.
Contains a preconfigured Redux and Redux-Sagas setup. Review each file carefully to see how Redux interacts with your application.
Here again we have generators to help you out. You just have to use one of the following:
ir-app redux Amazing
- Will generate the redux for Amazing
.ir-app saga Amazing
- The same as above, but for the SagasContains your API service and other important utilities for your application.
Api.js
- main API service, giving you an interface to communicate with your back endFixtureApi.js
- mocks your API service, making it faster to develop early on in your appRehydrationServices.js
- part of the redux-persist implementationWe recommend using this folder for modules that can be extracted into their own NPM packages at some point.
Contains actual images (usually png) used in your application.
Helpers for transforming data between API and your application and vice versa. An example is provided that you can look at to see how it works.
In a situation were you want to create a component, container, redux or saga or any variations of these you can run the following commands
ir-app gen redux saga Amazing
- Will generate the redux and saga for Amazing
.ir-app g comp cont redux saga Register
- This will generate a component, container, redux and saga for Register.
import Loadable from 'react-loadable'
const Button = Loadable({
loader: () => import('../Components/Button'),
loading: () => <div>loading...</div>
});