-
JS file and folder name may only contain lowercase alphanumeric characters and hyphen.
-
Separate your imports into 2 sections: 3rd party libraries and our own code.
-
If a module contain many things, import exactly those things that you require, not the whole module. i.e.
import { findDOMNode, unmountComponentAtNode } from 'react-dom';
is good,import ReactDOM from 'react-dom';
is less nice.
-
Test module will live at the exact same path as the module it wishes to test. For example,
test/components/common/article-footer.js
will contain test forsrc/js/components/common/article-footer.js
. -
When you need factory, use one or create one using rosie. See here for example.
-
Some components need required props in order to work. To test such component with
should.renderable()
(which doesn't pass down any prop), usedefaultProps
. See example in here.
- Wrap your markup in () before returning it and start markup on a separate line, make it easier to read. e.g.
return (
<p>some text</p>
);
- Use arrow functions when the function still look good defined inline and/or it need to use
this
from outside scope. Callback prop to children is thus a very good usecase for arrow function.