React.js starter app
You must be using a version of Node > 7.0
git clone git@github.com:juiceboxes/react-starter-app.git
-
npm install
-
npm run start
- starts webpack bundler and serves the files with webpack dev server
-
Navigate to
localhost:8002
- Travis is used to test the build for this code.
npm run test
will run linters and tests- test folder is configured
This file exports an object with the configuration for webpack and webpack dev server.
-
High-Order Component
- a higher-order component is a function that takes a component and returns a new component
-
Smart/Presentational Components
- Smart components have access to the redux state
- Presentational components do not have access to the redux state
- Smart Components === insights-frontend/app/js/states
- Presentational Components === insights-frontend/app/js/components
-
State and lifecycle within class components
- article contains:
- Adding Lifecycle Methods to a Class
- Adding Local State to a Class
- State Updates May Be Asynchronous
- State Updates are Merged
- article contains:
- Provider
- Makes the Redux store available to the connect()
- connect([mapStateToProps], [mapDispatchToProps], [mergeProps], [options])
- Connects a React component to a Redux store
When setting up the routes, the page content is wrapped with a .page__{pageName}
class, applied to the #root
ID that is determined by the rootClass
in the Routes.js
which lets you easily reference the page in the styling.
- BrowserRouter
- A
<Router>
that uses the HTML5 history API (pushState, replaceState and the popstate event) to keep your UI in sync with the URL
- A
- Route
- Switch
- Renders the first child
<Route>
or<Redirect>
that matches the location.
- Renders the first child
- Redirect
- navigate to a new location
- withRouter
- passes updated match, location, and history props to the wrapped component whenever it renders