react-toolbox-themr icon indicating copy to clipboard operation
react-toolbox-themr copied to clipboard

Improve instructions to integrate into a `create-react-app` app

Open gnapse opened this issue 8 years ago • 4 comments

  • Moves the generated asset files into src/ because you can't normally import from outside it.
  • Adds the import of the theme.css file, 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.

gnapse avatar Jun 14 '17 13:06 gnapse

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

dennistang avatar Jul 09 '17 05:07 dennistang

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.

gnapse avatar Jul 09 '17 17:07 gnapse

Hello?

gnapse avatar Jan 27 '18 00:01 gnapse

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 🙂

hawkins avatar May 06 '18 15:05 hawkins