Skip to content

Commit

Permalink
Update react reference links in readme files
Browse files Browse the repository at this point in the history
  • Loading branch information
akasunil committed Jun 20, 2024
1 parent 603d2c1 commit 283ffec
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
8 changes: 4 additions & 4 deletions packages/block-editor/src/components/block-context/README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# Block Context

Block Context is a React implementation of WordPress's block context. Block context, much like [React's context](https://reactjs.org/docs/context.html), is a method for passing and inheriting values deeply through a hierarchy of blocks. Because of the similarities with React's context, the client-side implementation here is quite minimal. It is complemented by equivalent behaviors in the server-side rendering of a block.
Block Context is a React implementation of WordPress's block context. Block context, much like [React's context](https://react.dev/learn/passing-data-deeply-with-context), is a method for passing and inheriting values deeply through a hierarchy of blocks. Because of the similarities with React's context, the client-side implementation here is quite minimal. It is complemented by equivalent behaviors in the server-side rendering of a block.

Note that the implementation of Block Context is distinct from [the `BlockEdit` context](../block-edit). While it is true that both provide context relevant for the editing of a block, Block Context is implemented separately so as to prioritize it as most identifiable amongst the machinery of block context, and not amongst other client-side editing context of a block.

## Usage

Currently, only the [Provider component](https://reactjs.org/docs/context.html#contextprovider) is made available on the public interface of the `@wordpress/block-editor` module. This can be used to add or override context which can then be consumed by blocks rendered within that context in the block editor.
Currently, only the [Provider component](https://react.dev/reference/react/createContext#provider) is made available on the public interface of the `@wordpress/block-editor` module. This can be used to add or override context which can then be consumed by blocks rendered within that context in the block editor.

```js
import { BlockContextProvider } from '@wordpress/block-editor';
Expand All @@ -20,7 +20,7 @@ function MyCustomPostEditor() {
}
```

Internal to the `@wordpress/block-editor` module, a component can access the [full Context object](https://reactjs.org/docs/context.html#api), typically for use in combination with [`useContext`](https://reactjs.org/docs/hooks-reference.html#usecontext).
Internal to the `@wordpress/block-editor` module, a component can access the [full Context object](https://react.dev/learn/passing-data-deeply-with-context), typically for use in combination with [`useContext`](https://react.dev/reference/react/useContext).

```js
import { useContext } from 'react';
Expand All @@ -39,7 +39,7 @@ The reason `BlockContext` is only internally available within the `@wordpress/bl

## Props

`BlockContextProvider` behaves like a standard [`Context.Provider` component](https://reactjs.org/docs/context.html#contextprovider). It receives `value` and `children` props. The `value` is merged with the current block context value.
`BlockContextProvider` behaves like a standard [`Context.Provider` component](https://react.dev/reference/react/createContext#provider). It receives `value` and `children` props. The `value` is merged with the current block context value.

### `value`

Expand Down
2 changes: 1 addition & 1 deletion packages/components/src/card/card/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ const Example = () => (

### Context

`<Card />`'s sub-components are connected to `<Card />` using [Context](https://reactjs.org/docs/context.html). Certain props like `size` and `isBorderless` are passed through to some of the sub-components.
`<Card />`'s sub-components are connected to `<Card />` using [Context](https://react.dev/learn/passing-data-deeply-with-context). Certain props like `size` and `isBorderless` are passed through to some of the sub-components.

In the following example, the `<CardBody />` will render with a size of `small`:

Expand Down
2 changes: 1 addition & 1 deletion packages/components/src/disabled/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ const MyDisabled = () => {
};
```

A component can detect if it has been wrapped in a `<Disabled />` by accessing its [context](https://reactjs.org/docs/context.html) using `Disabled.Context`.
A component can detect if it has been wrapped in a `<Disabled />` by accessing its [context](https://react.dev/learn/passing-data-deeply-with-context) using `Disabled.Context`.

```jsx
function CustomButton( props ) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ const BottomSheetNavigationScreen = ( {
* passed to useCallback here is what prevents erroneous callback
* replacements, but leveraging memoization to achieve this is brittle and
* explicitly discouraged in the React documentation.
* https://reactjs.org/docs/hooks-reference.html#usememo
* https://react.dev/reference/react/useMemo
*
* Ideally, we refactor onHandleHardwareButtonPress to manage multiple
* callbacks triggered based upon which screen is currently active.
Expand Down

0 comments on commit 283ffec

Please sign in to comment.