Skip to content

Commit 2f7b235

Browse files
author
zhenghe
committed
add styles for import statement and default state of reducer
1 parent 6a4be96 commit 2f7b235

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

react/ComponentStyle.md

+22
Original file line numberDiff line numberDiff line change
@@ -312,6 +312,12 @@ export default PureMadadata;
312312
}
313313
```
314314
315+
* prefer using isolated statement for defaultState when declaring reducer
316+
```
317+
const initialState = { isFetching: false };
318+
export default function reducer(state = initialState, action) {}
319+
```
320+
315321
* proposes
316322
* prefer using ES6 Symbol for action type.
317323
@@ -320,3 +326,19 @@ export default PureMadadata;
320326
```
321327
322328
so that we don't have to type long words and disable eslint-max-len. Any there will be no name clashes.
329+
330+
# Import
331+
332+
* prefer specific import first and default import next
333+
334+
```
335+
import React, { PropTypes, Component } from 'react';
336+
import { connect } from 'react-redux';
337+
import { showCredentials, hideCredentials } from '../../modules/credentials/action';
338+
import { showDetails, hideDetails } from '../../modules/details/action';
339+
import { hideScheduling } from '../../modules/scheduling/action';
340+
import { hideNamingNDescribing } from '../../modules/namingndescribing/action';
341+
import Collapse from 'react-collapse';
342+
import MDButton from 'mdbutton';
343+
import styles from '../App/App.css';
344+
```

0 commit comments

Comments
 (0)