File tree Expand file tree Collapse file tree 2 files changed +24
-1
lines changed Expand file tree Collapse file tree 2 files changed +24
-1
lines changed Original file line number Diff line number Diff line change 20
20
"react" : " ^0.13.3" ,
21
21
"react-router" : " ^1.0.0-beta2" ,
22
22
"reactify" : " ^1.1.0" ,
23
+ "reflux" : " ^0.2.8" ,
23
24
"vinyl-source-stream" : " ^1.1.0" ,
24
25
"watchify" : " ^2.4.0" ,
25
26
"whatwg-fetch" : " ^0.9.0"
Original file line number Diff line number Diff line change 1
1
var React = require ( 'react' ) ;
2
+ var Api = require ( '../utils/api' ) ;
2
3
3
4
module . exports = React . createClass ( {
5
+ getInitialState : function ( ) {
6
+ return {
7
+ topics : [ ]
8
+ }
9
+ } ,
10
+ componentWillMount : function ( ) {
11
+ Api . get ( 'topics/defaults' )
12
+ . then ( function ( data ) {
13
+ this . setState ( {
14
+ topics : data . data
15
+ } )
16
+ } . bind ( this ) ) ;
17
+ } ,
4
18
render : function ( ) {
5
19
return < div className = "list-group" >
6
20
Topic List
21
+ { this . renderTopics ( ) }
7
22
</ div >
23
+ } ,
24
+ renderTopics : function ( ) {
25
+ return this . state . topics . map ( function ( topic ) {
26
+ return < li >
27
+ { topic }
28
+ </ li >
29
+ } ) ;
8
30
}
9
- } )
31
+ } ) ;
You can’t perform that action at this time.
0 commit comments