improve demo es6 class code style

This commit is contained in:
afc163 2017-02-20 21:47:57 +08:00
parent 2da59c3679
commit f2d12306bd
7 changed files with 18 additions and 38 deletions

View File

@ -37,11 +37,8 @@ const columns = [{
}];
class Page extends React.Component {
constructor() {
super();
this.state = {
visible: false,
};
state = {
visible: false,
}
showModal = () => {
this.setState({ visible: true });

View File

@ -17,13 +17,11 @@ Wrap your app with `LocaleProvider`, and apply the corresponding language packag
import { Pagination, LocaleProvider } from 'antd';
import enUS from 'antd/lib/locale-provider/en_US';
function App() {
return (
<div>
<Pagination defaultCurrent={1} total={50} showSizeChanger />
</div>
);
}
const App = () = >(
<div>
<Pagination defaultCurrent={1} total={50} showSizeChanger />
</div>
};
ReactDOM.render(
<LocaleProvider locale={enUS}>

View File

@ -19,12 +19,9 @@ import { Mention } from 'antd';
const users = ['afc163', 'benjycui', 'yiminghe', 'jljsj33', 'dqaria', 'RaoHai'];
class AsyncMention extends React.Component {
constructor() {
super();
this.state = {
suggestions: [],
loading: false,
};
state = {
suggestions: [],
loading: false,
}
fetchSuggestions(value, callback) {
setTimeout(() => {

View File

@ -27,11 +27,8 @@ const webFrameworks = [
];
class CustomNavMention extends React.Component {
constructor() {
super();
this.state = {
suggestions: [],
};
state = {
suggestions: [],
}
onSearchChange = (value) => {
const searchValue = value.toLowerCase();

View File

@ -18,11 +18,8 @@ import { Mention } from 'antd';
const { toEditorState } = Mention;
class App extends React.Component {
constructor() {
super();
this.state = {
value: toEditorState('@afc163'),
};
state = {
value: toEditorState('@afc163'),
}
handleChange = (editorState) => {
this.setState({

View File

@ -19,11 +19,8 @@ const { toEditorState, getMentions } = Mention;
const FormItem = Form.Item;
class App extends React.Component {
constructor() {
super();
this.state = {
initValue: toEditorState('@afc163'),
};
state = {
initValue: toEditorState('@afc163'),
}
handleReset = (e) => {
e.preventDefault();

View File

@ -32,11 +32,8 @@ function onSelect(suggestion, data) {
}
class CustomNavMention extends React.Component {
constructor() {
super();
this.state = {
suggestions: [],
};
state = {
suggestions: [],
}
onSearchChange = (value) => {
const searchValue = value.toLowerCase();