Skip to content

Instantly share code, notes, and snippets.

@JonAbrams
Last active July 23, 2018 01:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JonAbrams/be60c120b6edc77ffbb02e9e84ec4c80 to your computer and use it in GitHub Desktop.
Save JonAbrams/be60c120b6edc77ffbb02e9e84ec4c80 to your computer and use it in GitHub Desktop.
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