0

I have the following:

const MyPage = (props) => {
  return (
    <MyLayout {...props}>
      ...

I need to pass props to MyLayout, problem is eslint doesn't like this and is rejecting the code w:

unexpected block statement surrounding arrow body

How can I get the func to pass props and comply with eslint?

Thanks

AnnaSm
  • 2,190
  • 6
  • 22
  • 32
  • Possible duplicate of [Eslint arrow-body-style error in react.js](https://stackoverflow.com/questions/42217761/eslint-arrow-body-style-error-in-react-js) – pwolaq Feb 17 '18 at 18:44

1 Answers1

1

The problem is not with the props but around arrow body when you only have return inside it, you dont need to have curly brackets or return.

This will work.

const MyPage = (props) => <div>
<MyLayout {...props}>
.... 
</MyLayout>
<MyComponent />
</div>
eshunsharma
  • 171
  • 9