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

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>
);
}
}
主站蜘蛛池模板: 永清县| 临海市| 灌阳县| 东港市| 香港| 林甸县| 高台县| 赞皇县| 寿光市| 钟山县| 九龙坡区| 鲁山县| 策勒县| 页游| 房产| 尖扎县| 乌恰县| 彰化市| 融水| 永德县| 诸城市| 鄂托克前旗| 尼勒克县| 喀什市| 龙川县| 沂源县| 漳浦县| 铁力市| 舟曲县| 措美县| 苍南县| 澄迈县| 江都市| 泽普县| 拜泉县| 长顺县| 高唐县| 始兴县| 潮州市| 靖远县| 阳春市|