Last active
July 5, 2016 23:59
-
-
Save wyqydsyq/297dc375d65bd18b8e7ed638ec86cd78 to your computer and use it in GitHub Desktop.
Cycle wrapping
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import {h} from '@cycle/dom'; | |
import xs from 'xstream'; | |
import Test2 from './test2'; | |
import Test3 from './test3'; | |
let Test1 = function(sources) { | |
return { | |
DOM: Test2(sources).DOM | |
// DOM: Test3().DOM | |
}; | |
} | |
export default Test1; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import {h} from '@cycle/dom'; | |
import xs from 'xstream'; | |
import Test3 from './test3'; | |
const Test2 = ({DOM}) => { | |
let render = (view) => { console.log(view({DOM}).DOM) | |
return h('div', [ | |
h('p', 'First Child'), | |
view({DOM}).DOM | |
]); | |
}, | |
vtree$ = xs.of(Test3).map(render); | |
return { | |
DOM: vtree$ | |
} | |
}; | |
export default Test2; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import {h} from '@cycle/dom'; | |
import xs from 'xstream'; | |
const Test2 = () => { | |
let render = (state) => { | |
return h('div', [ | |
h('p', 'Second Child'), | |
h('p', 'State is: ' + state) | |
]); | |
}, | |
vtree$ = xs.of(true).map(render); | |
return { | |
DOM: vtree$ | |
} | |
}; | |
export default Test2; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment