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

Our React App component

We have already touched on the use of components in React. By default, we will always have an App component. This is the component that will be rendered to the root element in our HTML. Our components derive from React.Component, so the start of our App component looks like the following:

import * as React from 'react';
import './App.css';

export default class App extends React.Component {

}

Of course, our component requires a well-known method to trigger the rendering of the component. It will not come as much of a surprise to learn that the method is called render. As we are using Bootstrap to display our UI, we want to be rendering out a component that relates to our Container div. To do this, we are going to use a Container component from reactstrap (and introduce the core component that we are going to use to display our interface):

import * as React from 'react';
import './App.css';
import Container from 'reactstrap/lib/Container';
import PersonalDetails from './PersonalDetails';
export default class App extends React.Component {
public render() {
return (
<Container>
<PersonalDetails />
</Container>
);
}
}
主站蜘蛛池模板: 衢州市| 霍州市| 巴东县| 甘德县| 玉溪市| 名山县| 平武县| 南雄市| 杭州市| 中阳县| 延长县| 阳山县| 龙游县| 云南省| 铜陵市| 红桥区| 兴业县| 襄汾县| 大余县| 堆龙德庆县| 临颍县| 霍林郭勒市| 盐山县| 黄石市| 南涧| 马鞍山市| 九龙县| 巴塘县| 波密县| 谷城县| 措美县| 桃园市| 镇宁| 怀宁县| 奉贤区| 沭阳县| 南澳县| 福建省| 隆尧县| 吴桥县| 台北市|