File tree Expand file tree Collapse file tree 1 file changed +15
-11
lines changed
Expand file tree Collapse file tree 1 file changed +15
-11
lines changed Original file line number Diff line number Diff line change @@ -12,27 +12,31 @@ npm start
1212it's really simple example(only 40 LOC) that reactively search github repo according to your query
1313
14140 . create normal React Component
15+
1516 ``` js
16- const TypeNsearch = (props )=> {
17- let {search} = props .actions
18- return < div>
19- < input onChange= {e => search (e .target .value )}>< / input>
20- < ul>
21- {props .results && props .results .map (item => {
22- return < li key= {item .id }>< a href= {item .html_url }> {item .full_name } ({item .stargazers_count })< / a>< / li>
23- })}
24- < / ul>
25- < / div>
26- }
17+ const TypeNsearch = (props )=> {
18+ let {search} = props .actions
19+ return < div>
20+ < input onChange= {e => search (e .target .value )}>< / input>
21+ < ul>
22+ {props .results && props .results .map (item => {
23+ return < li key= {item .id }>< a href= {item .html_url }> {item .full_name } ({item .stargazers_count })< / a>< / li>
24+ })}
25+ < / ul>
26+ < / div>
27+ }
2728 ```
29+
28301 . HOC(Higher Order Component)
2931 using ` connect ` to create a HOC over TypeNsearch
32+
3033 ``` js
3134 const MostTypeNSearch = connect (DATAFLOW )(TypeNsearch)
3235 ```
33362 . Compose Dataflow
3437 you see the place holder ` DATAFLOW ` , now we gonna fill in the real data flow how we enable the reactive action of our Component
3538 1 . filter out stream only with ` intent.type ` of 'search'
39+
3640 ``` js
3741 function (intent$ ){
3842 let updateSink$ = intent$ .filter (i => i .type == ' search' )
You can’t perform that action at this time.
0 commit comments