mirror of
https://github.com/reactjs/react.dev.git
synced 2026-02-24 12:43:05 +00:00
fix: api links in content (#4806)
* fix: api reference links in content * fix: link on react dom api page
This commit is contained in:
@@ -30,7 +30,7 @@ import * as React from 'react';
|
||||
|
||||
</PackageImport>
|
||||
|
||||
If you use React on the web, you'll also need the same version of [ReactDOM](/api/reactdom).
|
||||
If you use React on the web, you'll also need the same version of [ReactDOM](/apis/reactdom).
|
||||
|
||||
## Exports {/*exports*/}
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@ import * as ReactDOMClient from 'react-dom/client';
|
||||
|
||||
</PackageImport>
|
||||
|
||||
You'll also need to install the same version of [React](/api/).
|
||||
You'll also need to install the same version of [React](/apis/).
|
||||
|
||||
## Browser Support {/*browser-support*/}
|
||||
|
||||
|
||||
@@ -927,7 +927,7 @@ ul, li { margin: 0; padding: 0; }
|
||||
|
||||
### Specifying a fallback default value {/*specifying-a-fallback-default-value*/}
|
||||
|
||||
If React can't find any providers of that particular <CodeStep step={1}>context</CodeStep> in the parent tree, the context value returned by `useContext()` will be equal to the <CodeStep step={3}>default value</CodeStep> that you specified when you [created that context](/api/createcontext):
|
||||
If React can't find any providers of that particular <CodeStep step={1}>context</CodeStep> in the parent tree, the context value returned by `useContext()` will be equal to the <CodeStep step={3}>default value</CodeStep> that you specified when you [created that context](/apis/createcontext):
|
||||
|
||||
```js [[1, 1, "ThemeContext"], [3, 1, "null"]]
|
||||
const ThemeContext = createContext(null);
|
||||
@@ -1337,11 +1337,11 @@ function MyComponent() {
|
||||
|
||||
#### Parameters {/*parameters*/}
|
||||
|
||||
* `SomeContext`: The context that you've previously created with [`createContext`](/api/createcontext). The context itself does not hold the information, it only represents the kind of information you can provide or read from components.
|
||||
* `SomeContext`: The context that you've previously created with [`createContext`](/apis/createcontext). The context itself does not hold the information, it only represents the kind of information you can provide or read from components.
|
||||
|
||||
#### Returns {/*returns*/}
|
||||
|
||||
`useContext` returns the context value for the calling component. It is determined as the `value` passed to the closest `SomeContext.Provider` above the calling component in the tree. If there is no such provider, then the returned value will be the `defaultValue` you have passed to [`createContext`](/api/createcontext) for that context. The returned value is always up-to-date. React automatically re-renders components that read some context if it changes.
|
||||
`useContext` returns the context value for the calling component. It is determined as the `value` passed to the closest `SomeContext.Provider` above the calling component in the tree. If there is no such provider, then the returned value will be the `defaultValue` you have passed to [`createContext`](/apis/createcontext) for that context. The returned value is always up-to-date. React automatically re-renders components that read some context if it changes.
|
||||
|
||||
#### Caveats {/*caveats*/}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user