-
Notifications
You must be signed in to change notification settings - Fork 24.8k
Closed
Labels
JavaScriptReactResolution: LockedThis issue was locked by the bot.This issue was locked by the bot.Type: DiscussionLong running discussion.Long running discussion.📮Known IssuesThis indicates an issue that refers to a bug or limitation of RN that is not currently being handledThis indicates an issue that refers to a bug or limitation of RN that is not currently being handled
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 />
);
};
brunolemos, luthfianto, JonnyBurger, cpouldev, exced and 35 moredeveloper239, Jahans3, borisyankov, Faultless, tibbus and 3 more
Metadata
Metadata
Assignees
Labels
JavaScriptReactResolution: LockedThis issue was locked by the bot.This issue was locked by the bot.Type: DiscussionLong running discussion.Long running discussion.📮Known IssuesThis indicates an issue that refers to a bug or limitation of RN that is not currently being handledThis indicates an issue that refers to a bug or limitation of RN that is not currently being handled