Skip to content

Commit d5b49a2

Browse files
gaearonjavivelasco
authored andcommitted
Document usage with Create React App (react-toolbox#1482)
1 parent 3d8cd66 commit d5b49a2

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

README.md

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,13 @@ Although we recommend [webpack](https://webpack.github.io/), you are free to use
2323

2424
Of course this is a set of React components so you should be familiar with [React](https://facebook.github.io/react/). If want to customize your components via themes, you may want to take a look to [react-css-themr](https://github.com/javivelasco/react-css-themr) which is used by React Toolbox to make components easily themeable.
2525

26-
### Setting up PostCSS+cssnext in Webpack:
26+
### Usage in Create React App Projects
27+
28+
[Create React App](https://github.com/facebookincubator/create-react-app) does not allow to change the default configuration, so you need an additional build step to configure `react-toolbox` in its project.
29+
30+
Follow [these instructions](https://github.com/react-toolbox/react-toolbox-themr) to add `react-toolbox` to a project created with Create React App.
31+
32+
### Usage in Webpack Projects (*Not* Create React App)
2733

2834
```bash
2935
npm install postcss-loader --save-dev
@@ -67,6 +73,13 @@ ReactDOM.render(
6773
);
6874
```
6975

76+
>**Note:** if you use it with Create React App, you need to make this additional change:
77+
>
78+
>```diff
79+
>- import {Button} from 'react-toolbox/lib/button';
80+
>+ import Button from 'react-toolbox/lib/button/Button';
81+
>```
82+
7083
Take into account that any required style will be included in the final CSS so your final CSS would include `Button` styles in this case. It's more efficient to import components this way (`from 'react-toolbox/lib/button'`) (or with raw imports) because if you require from the project root (i.e. `from 'react-toolbox'`), every stylesheet of React Toolbox will be included, even if you don't use it.
7184
7285
## Importing components

0 commit comments

Comments
 (0)