mirror of
https://github.com/reactjs/react.dev.git
synced 2026-02-23 20:23:08 +00:00
Add more exports
This commit is contained in:
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user