This is my first time putting together a new app with this stack. Previously, I worked on an inherited one at another gig where the plumbing was already setup. My props are undefined and I need to know why. Please make suggestions, too. Here's the abridged code:
index.js
const store = createStore(rootReducer);
render(<Root store={store} />, document.getElementById("root"));
Root.js
const Root = ({ store }) => (
<Provider store={store}>
<Router>
<Route path="/:filter?" component={App} />
</Router>
</Provider>
);
Root.propTypes = {
store: PropTypes.object.isRequired
};
export default Root;
App.js
const App = ({ classes }) => ( // SHOULDN'T THIS BE DESTRUCTURED FROM PROPS?
<div className={classes.root}> // <== UNDEFINED...WHY NO PROPS?
<Grid container spacing={24}>
<Grid item xs={12}>
<AppBar />
</Grid>
</Grid>
</div>
);
export default withRoot(compose(connect())(App));
withRoot.js (creates a default theme from Material-UI)
const theme = createMuiTheme({
palette: {
type: "dark"
},
typography: {
fontFamily: '"Roboto", "Helvetica", "Arial", sans-serif',
fontSize: 14,
fontWeightLight: 300,
fontWeightRegular: 400,
fontWeightMedium: 500
}
});
function withRoot(Component) {
function WithRoot(props) {
// MuiThemeProvider makes the theme available down the React tree
// thanks to React context.
return (
<MuiThemeProvider theme={theme}>
{/* CssBaseline kickstart an elegant, consistent, and simple baseline to build upon. */}
<CssBaseline />
<Component {...props} />
</MuiThemeProvider>
);
}
return WithRoot;
}
export default withRoot;