Skip to content

Commit

Permalink
Add a mention of useStore to "Accessing the Store"
Browse files Browse the repository at this point in the history
  • Loading branch information
markerikson committed Mar 28, 2020
1 parent 172b233 commit a6a7523
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions docs/using-react-redux/accessing-store.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ by a single default context object instance generated by `React.createContext()`
React Redux's `<Provider>` component uses `<ReactReduxContext.Provider>` to put the Redux store and the current store
state into context, and `connect` uses `<ReactReduxContext.Consumer>` to read those values and handle updates.

## Using the `useStore` Hook

The [`useStore` hook](../api/hooks.md#useStore) returns the current store instance from the default `ReactReduxContext`. If you truly need to access the store, this is the recommended approach.

## Providing Custom Context

Instead of using the default context instance from React Redux, you may supply your own custom context instance.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ propagated to connected components, so that this works as expected by default.
However, there may be certain use cases where you may need to customize how the store and state are propagated to
connected components, or access the store directly. Here are some examples of how to do this.

## Using the `useStore` Hook

The [`useStore` hook](../api/hooks.md#useStore) returns the current store instance from the default `ReactReduxContext`. If you truly need to access the store, this is the recommended approach.

## Understanding Context Usage

Internally, React Redux uses [React's "context" feature](https://reactjs.org/docs/context.html) to make the
Expand Down

0 comments on commit a6a7523

Please sign in to comment.