- Redux Quick Start Guide
- James Lee Tao Wei Suresh Kumar Mukhiya
- 162字
- 2021-07-02 12:40:32
Creating the first container
Let's create our first container component, inside of app/containers/App/index.js:
import React from 'react';
import HomePage from 'containers/HomePage/Loadable';
export default function App() {
return (
<div>
<HomePage />
</div>
);
}
The home page container contains two files, Loadable.js and index.js:
import loadable from 'loadable-components';
export default loadable(() => import('./index'));
The index.js is as follows:
import React, { PureComponent } from 'react';
/* eslint-disable react/prefer-stateless-function */
export default class HomePage extends PureComponent {
render() {
return <h1>This is the HomePage Redux-book container!</h1>;
}
}
The complete code for this project can be found in the GitHub repository, inside of the CH01 starter files. We are going to continue using it in other chapters. Once you have these files up in your editor, we can start to run our first application. To run the application, the first thing to do is install the npm dependencies, as follows:
yarn install
yarn run
The application should start at http://localhost:8080/.
推薦閱讀
- jQuery Mobile Web Development Essentials(Third Edition)
- The Supervised Learning Workshop
- JavaScript:Functional Programming for JavaScript Developers
- Mastering Kotlin
- Bootstrap 4:Responsive Web Design
- Responsive Web Design by Example
- Gradle for Android
- MySQL從入門到精通(軟件開發視頻大講堂)
- Hands-On GUI Programming with C++ and Qt5
- 遠方:兩位持續創業者的點滴思考
- Python數據預處理技術與實踐
- FusionCharts Beginner’s Guide:The Official Guide for FusionCharts Suite
- Kohana 3.0 Beginner's Guide
- Clojure Data Structures and Algorithms Cookbook
- Learning Dynamics NAV Patterns