- 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/.
推薦閱讀
- 從零構建知識圖譜:技術、方法與案例
- Visual FoxPro程序設計教程(第3版)
- x86匯編語言:從實模式到保護模式(第2版)
- Hands-On C++ Game Animation Programming
- 名師講壇:Java微服務架構實戰(SpringBoot+SpringCloud+Docker+RabbitMQ)
- Java 11 Cookbook
- D3.js 4.x Data Visualization(Third Edition)
- 深入淺出PostgreSQL
- H5頁面設計:Mugeda版(微課版)
- RabbitMQ Essentials
- ArcGIS for Desktop Cookbook
- 代碼閱讀
- Django 5企業級Web應用開發實戰(視頻教學版)
- Learning Splunk Web Framework
- Android系統下Java編程詳解