File tree Expand file tree Collapse file tree 1 file changed +37
-0
lines changed Expand file tree Collapse file tree 1 file changed +37
-0
lines changed Original file line number Diff line number Diff line change @@ -164,6 +164,43 @@ export default class CounterContainer {
164
164
}
165
165
```
166
166
167
+ #### Decorators
168
+
169
+ Don't want to separate dumb and smart components just yet?
170
+ Use the decorators.
171
+ They work exactly the same as the container components, but are lowercase:
172
+
173
+ ``` js
174
+ import React , { PropTypes } from ' react' ;
175
+ import { increment , decrement } from ' ./actions/CounterActions' ;
176
+ import { container } from ' redux' ;
177
+ import counterStore from ' ./stores/counterStore' ;
178
+
179
+ @container ({
180
+ actions: { increment, decrement },
181
+ stores: counterStore
182
+ })
183
+ export default class Counter {
184
+ static propTypes = {
185
+ increment: PropTypes .func .isRequired ,
186
+ decrement: PropTypes .func .isRequired ,
187
+ counter: PropTypes .number .isRequired
188
+ };
189
+
190
+ render () {
191
+ return (
192
+ < p>
193
+ Clicked: {this .props .counter } times
194
+ {' ' }
195
+ < button onClick= {() => this .props .increment ()}> + < / button>
196
+ {' ' }
197
+ < button onClick= {() => this .props .decrement ()}> - < / button>
198
+ < / p>
199
+ );
200
+ }
201
+ }
202
+ ```
203
+
167
204
#### The root component
168
205
169
206
``` js
You can’t perform that action at this time.
0 commit comments