react-toolbox / react-toolbox-themr

A tool to statically extract and generate custom themes for React Toolbox
MIT License
240 stars 24 forks source link

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

Open gnapse opened 7 years ago

gnapse commented 7 years ago

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.

dennistang commented 6 years ago

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

gnapse commented 6 years ago

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 commented 6 years ago

Hello?

hawkins commented 6 years ago

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 🙂