官术网_书友最值得收藏!

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/.

主站蜘蛛池模板: 阳曲县| 嘉峪关市| 麦盖提县| 云梦县| 连平县| 岚皋县| 会昌县| 岫岩| 云浮市| 临邑县| 神池县| 卓尼县| 新安县| 舞阳县| 安多县| 庆城县| 北安市| 贺州市| 财经| 仙游县| 博白县| 沙湾县| 鄂托克旗| 永城市| 江门市| 安康市| 青河县| 三江| 鄯善县| 沙雅县| 敖汉旗| 东阳市| 宝应县| 闻喜县| 依安县| 二连浩特市| 马龙县| 乐昌市| 吉水县| 延边| 昌邑市|