1. 程式人生 > >Warning: Failed prop type: Invalid prop `children` supplied to `Container`.

Warning: Failed prop type: Invalid prop `children` supplied to `Container`.

Container 元件

const Container = ({ classes, children }) => (
  <Paper elevation={4} className={classes.root}>
    {children}
  </Paper>
)

錯誤JSX 程式碼

{
    (createdTopics && createdTopics.length > 0) && (<List><TopciListItem /></List>)
}

正確程式碼

{
  (createdTopics && createdTopics.length > 0) 
  ? (<List><TopciListItem /></List>)
  : null
}