From c0b6e0bbb1a05693e7185fe7caaf2c276cbc27df Mon Sep 17 00:00:00 2001 From: Dan Abramov Date: Wed, 16 Mar 2022 01:40:00 +0000 Subject: [PATCH] Add more exports --- beta/src/pages/apis/index.md | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/beta/src/pages/apis/index.md b/beta/src/pages/apis/index.md index 63cd2c3e..712b8a17 100644 --- a/beta/src/pages/apis/index.md +++ b/beta/src/pages/apis/index.md @@ -34,6 +34,8 @@ If you use React on the web, you'll also need the same version of [ReactDOM](/ap ## Exports {/*exports*/} +### State {/*state*/} + Declares a state variable. @@ -46,6 +48,34 @@ function MyComponent() { + + +Declares a state variable managed with a reducer. + +```js +function MyComponent() { + const [state, dispatch] = useReducer(reducer, { age: 42 }); + // ... +``` + + + +### Context {/*context*/} + + + +Reads and subscribes to a context. + +```js +function MyComponent() { + const theme = useContext(ThemeContext); + // ... +``` + + + +### Refs {/*refs*/} + Declares a ref.