Last active
July 23, 2018 01:02
-
-
Save JonAbrams/be60c120b6edc77ffbb02e9e84ec4c80 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 Space, { subscribe } from 'spaceace'; | |
const space = new Space({ | |
appName: "SpaceAce demoe", | |
user: { name: 'Jon', level: 9001 } | |
}); | |
subscribe(space, ({ newSpace, causedBy }) => { | |
console.log(`State updated by ${causedBy}`); | |
ReactDOM.render( | |
<h1>{newSpace.appName}</h1>, | |
document.getElementById('app') | |
); | |
}); | |
// Causes React to render | |
space({ appName: "SpaceAce demo" }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment