Closed
Description
React Hooks will ship as part of React Native 0.59.
If you are interested in using Hooks before then, see my comment below.
Original issue:
- Review the documentation: https://facebook.github.io/react-native
- Search for existing issues: https://github.com/facebook/react-native/issues
- Use the latest React Native release: https://github.com/facebook/react-native/releases
Environment
[skip envinfo]
OS: Windows 10
Node: 10.11.0
Yarn: Not Found
npm: 6.4.1
Watchman: Not Found
Xcode: N/A
Android Studio: Version 3.2.0.0 AI-181.5540.7.32.5056338
Packages: (wanted => installed)
react: 16.7.0-alpha.0 => 16.7.0-alpha.0
react-native: https://github.com/expo/react-native/archive/sdk-30.0.0.tar.gz => 0.55.4
expo: 2.2.0
Description
When using React Hooks like useState
within a function component, I get the following error message.
hooks can only be called inside the body of a function component
export default function RootContainer(props) {
const [something, setSomething] = useState('nothing');
return (
<View />
);
};