react-toolbox-themr
react-toolbox-themr copied to clipboard
Improve instructions to integrate into a `create-react-app` app
- Moves the generated asset files into
src/because you can't normally import from outside it. - Adds the import of the
theme.cssfile, which is absolutely needed for this integration to work. - Minor couple of fixes.
These are based on my experience while trying to follow the instructions to integrate react-toolbox into a React app created with create-react-app. Especially the missing line importing the theme.css file was daunting for a few minutes, and almost made me quit and look for alternatives.
Were you able to get it working with CRA 1.3.1 with the example code?
Specifically, this isn't working for me:
const App = ({ children }) => (
<ThemeProvider theme={theme}>
{children}
</ThemeProvider>
);
export default App;
It gives me the error: React.Children.only expected to receive a single React element child
At a glance I think that does not have to do with my changes. The error you mention above is due to ThemeProvider not supporting more than one child element. If children in your example is an array of more than one item (or probably if it is an array of a single element) ThemeProvider will complain.
Hello?
Just made a new react app using CRA and toolbox, this PR had the only steps missing to make integration flawless today. Would love to see this merged 🙂