Browse Source

Add more exports

main
Dan Abramov 3 years ago
parent
commit
c0b6e0bbb1
  1. 30
      beta/src/pages/apis/index.md

30
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*/}
<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.

Loading…
Cancel
Save