You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/api/Provider.md
+17-13Lines changed: 17 additions & 13 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,8 +1,14 @@
1
+
---
2
+
id: provider
3
+
title: Provider
4
+
sidebar_label: Provider
5
+
---
6
+
1
7
# `<Provider />`
2
8
3
9
## Overview
4
10
5
-
The `<Provider />` makes the Redux `store` available to any nested components that have been wrapped in the `connect()` function.
11
+
The `<Provider />` makes the Redux `store` available to any nested components that have been wrapped in the `connect()` function.
6
12
7
13
Since any React component in a React-Redux app can be connected, most applications will render a `<Provider>` at the top level, with the entire app’s component tree inside of it.
8
14
@@ -15,26 +21,26 @@ Note: If you really need to, you can manually pass `store` as a prop to a connec
15
21
`store` (Redux Store)
16
22
The single Redux `store` in your application.
17
23
18
-
`children` (ReactElement)
19
-
The root of your component hierarchy.
24
+
`children` (ReactElement)
25
+
The root of your component hierarchy.
20
26
21
27
22
28
### Example Usage
23
29
24
-
In the example below, the `<App />` component is our root-level component. This means it’s at the very top of our component hierarchy.
30
+
In the example below, the `<App />` component is our root-level component. This means it’s at the very top of our component hierarchy.
25
31
26
-
**Vanilla React Example**
32
+
**Vanilla React Example**
27
33
28
34
```js
29
35
importReactfrom'react';
30
36
importReactDOMfrom'react-dom';
31
37
import { Provider } from'react-redux';
32
-
38
+
33
39
import { App } from'./App';
34
40
importcreateStorefrom'./createReduxStore';
35
-
41
+
36
42
conststore=createStore();
37
-
43
+
38
44
ReactDOM.render(
39
45
<Provider store={store}>
40
46
<App />
@@ -51,14 +57,14 @@ In the example below, the `<App />` component is our root-level component. This
51
57
importReactDOMfrom'react-dom';
52
58
import { Provider } from'react-redux';
53
59
import { Router, Route } from'react-router-dom';
54
-
60
+
55
61
import { App } from'./App';
56
62
import { Foo } from'./Foo';
57
63
import { Bar } from'./Bar';
58
64
importcreateStorefrom'./createReduxStore';
59
-
65
+
60
66
conststore=createStore();
61
-
67
+
62
68
ReactDOM.render(
63
69
<Provider store={store}>
64
70
<Router history={history}>
@@ -71,5 +77,3 @@ In the example below, the `<App />` component is our root-level component. This
0 commit comments