From 7bfa2ce6606e55c4035d40dfda83266629fbd3ad Mon Sep 17 00:00:00 2001 From: Mark Erikson Date: Sat, 28 Mar 2020 12:02:42 -0400 Subject: [PATCH] Add a mention of `useStore` to "Accessing the Store" --- docs/using-react-redux/accessing-store.md | 4 ++++ .../version-7.2/using-react-redux/accessing-store.md | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/docs/using-react-redux/accessing-store.md b/docs/using-react-redux/accessing-store.md index 9b4e2c658..be32e290d 100644 --- a/docs/using-react-redux/accessing-store.md +++ b/docs/using-react-redux/accessing-store.md @@ -26,6 +26,10 @@ by a single default context object instance generated by `React.createContext()` React Redux's `` component uses `` to put the Redux store and the current store state into context, and `connect` uses `` 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. diff --git a/website/versioned_docs/version-7.2/using-react-redux/accessing-store.md b/website/versioned_docs/version-7.2/using-react-redux/accessing-store.md index 611883d68..d651385a0 100644 --- a/website/versioned_docs/version-7.2/using-react-redux/accessing-store.md +++ b/website/versioned_docs/version-7.2/using-react-redux/accessing-store.md @@ -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