Last active
August 29, 2015 14:17
-
-
Save mikaelbr/25bc1aba1953c4dc3e84 to your computer and use it in GitHub Desktop.
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
var immstruct = require('immstruct'); | |
var component = require('omniscient'); | |
var data = immstruct({ a: {b: { c: { text: 'hello', foo: { bar: 'world' }}}}); | |
var AnotherComp = component((cursor) => /* ... */); | |
var TextComp = component((cursor) => ( | |
<div> | |
<p>{cursor.get('text')}</p> | |
<p>{AnotherComp(data.cursor(['a', 'b', 'c', 'foo', 'bar'])}</p> | |
</div> | |
)); | |
var App = component(function (cursor) { | |
// Use absolute path here | |
return <div> | |
<h1>Do something with {cursor.getIn(['a', 'b', 'c'])}</h1> | |
{TextComp(data.cursor(['a', 'b', 'c']))} | |
</div> | |
}); | |
React.render(App(data.cursor()), document.body) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment