質問編集履歴
2
stateの構成追記、initialStateの追記
test
CHANGED
File without changes
|
test
CHANGED
@@ -118,7 +118,7 @@
|
|
118
118
|
|
119
119
|
|
120
120
|
|
121
|
-
export function reducerB(state = initialState
|
121
|
+
export function reducerB(state = initialStateB, action){
|
122
122
|
|
123
123
|
switch (action.type) {
|
124
124
|
|
1
質問内容の補足
test
CHANGED
File without changes
|
test
CHANGED
@@ -28,11 +28,47 @@
|
|
28
28
|
|
29
29
|
|
30
30
|
|
31
|
+
##追記:State全体の構成
|
32
|
+
|
33
|
+
```javascript
|
34
|
+
|
35
|
+
const state = {
|
36
|
+
|
37
|
+
reducerA: {
|
38
|
+
|
39
|
+
a:"a"
|
40
|
+
|
41
|
+
}
|
42
|
+
|
43
|
+
|
44
|
+
|
45
|
+
reducerB: {
|
46
|
+
|
47
|
+
b:"b"
|
48
|
+
|
49
|
+
}
|
50
|
+
|
51
|
+
|
52
|
+
|
53
|
+
reducerC: {
|
54
|
+
|
55
|
+
c:"c"
|
56
|
+
|
57
|
+
}
|
58
|
+
|
59
|
+
};
|
60
|
+
|
61
|
+
```
|
62
|
+
|
63
|
+
|
64
|
+
|
31
|
-
### 該当のソースコード
|
65
|
+
### 該当のソースコード ※initialState追記しました
|
32
66
|
|
33
67
|
|
34
68
|
|
35
69
|
```javascript
|
70
|
+
|
71
|
+
|
36
72
|
|
37
73
|
export const actionX = (a, b, c) => ({
|
38
74
|
|
@@ -48,7 +84,15 @@
|
|
48
84
|
|
49
85
|
|
50
86
|
|
87
|
+
const initialStateA = {
|
88
|
+
|
89
|
+
a: "",
|
90
|
+
|
91
|
+
};
|
92
|
+
|
93
|
+
|
94
|
+
|
51
|
-
export function reducerA(state, action){
|
95
|
+
export function reducerA(state = initialStateA, action){
|
52
96
|
|
53
97
|
switch (action.type) {
|
54
98
|
|
@@ -66,7 +110,15 @@
|
|
66
110
|
|
67
111
|
|
68
112
|
|
113
|
+
const initialStateB = {
|
114
|
+
|
115
|
+
b: "",
|
116
|
+
|
117
|
+
};
|
118
|
+
|
119
|
+
|
120
|
+
|
69
|
-
export function reducerB(state, action){
|
121
|
+
export function reducerB(state = initialStateA, action){
|
70
122
|
|
71
123
|
switch (action.type) {
|
72
124
|
|
@@ -84,7 +136,15 @@
|
|
84
136
|
|
85
137
|
|
86
138
|
|
139
|
+
const initialStateC = {
|
140
|
+
|
141
|
+
c: "",
|
142
|
+
|
143
|
+
};
|
144
|
+
|
145
|
+
|
146
|
+
|
87
|
-
export function reducerC(state, action){
|
147
|
+
export function reducerC(state = initialStateC, action){
|
88
148
|
|
89
149
|
switch (action.type) {
|
90
150
|
|