Add more exports

This commit is contained in:
Dan Abramov
2022-03-16 01:40:00 +00:00
parent f7f92b88e9
commit c0b6e0bbb1

View File

@@ -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*/}
<YouWillLearnCard title="useState" path="/apis/usestate">
Declares a state variable.
@@ -46,6 +48,34 @@ function MyComponent() {
</YouWillLearnCard>
<YouWillLearnCard title="useReducer" path="/apis/usereducer">
Declares a state variable managed with a reducer.
```js
function MyComponent() {
const [state, dispatch] = useReducer(reducer, { age: 42 });
// ...
```
</YouWillLearnCard>
### Context {/*context*/}
<YouWillLearnCard title="useContext" path="/apis/usecontext">
Reads and subscribes to a context.
```js
function MyComponent() {
const theme = useContext(ThemeContext);
// ...
```
</YouWillLearnCard>
### Refs {/*refs*/}
<YouWillLearnCard title="useRef" path="/apis/useref">
Declares a ref.