So I just initialized a React Native project the other day and was trying to configure my eslint and for some reason I get an unexpected token <
error on the return for my stateless JSX component.
import React from 'react';
const User = () => {
return (
<>
<Text>
Hello!
</Text>
</>
);
};
export default User
I am extending the default @react-native-community
that the eslintrc file is initialized with.
As another note I was trying to use the airbnb eslint configuration and that causes the unexpected token error on both js and jsx files at the same location. I was wondering if anyone knew the reason as to why I am getting this error. Thanks in advance for the help!
Fixed: As stated below my fix ended up being to install babel-eslint and set my parser to babel-eslint in the eslintrc file.
<>
. Try using<React.Fragment>
. - humanbeanparser: 'babel-eslint'
solved this for me. - jay surya