Created
October 5, 2019 22:42
-
-
Save hatertron3000/f426f53911af379ad104768fc962762b to your computer and use it in GitHub Desktop.
A JavaScript module that extends the PageClasses module from Cornerstone, and uses it to render a React component with context from the page.
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 React from 'react' | |
import ReactDOM from 'react-dom' | |
import PageManager from '../page-manager' | |
const HelloWorld = (props) => ( | |
<div> | |
<p>Hello World from React!</p> | |
<p>Here are my props:</p> | |
<pre>{JSON.stringify(props, null, 2)}</pre> | |
</div> | |
) | |
export default class ReactDemo extends PageManager { | |
onReady() { | |
const container = $('#root')[0] | |
ReactDOM.render(<HelloWorld context={this.context}/>, container) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment