Skip to content
Snippets Groups Projects
Commit 0a8d9ab7 authored by Ray Schamp's avatar Ray Schamp
Browse files

Explanatory comments and lint

parent cb96e03f
No related branches found
No related tags found
No related merge requests found
......@@ -101,6 +101,7 @@ StageComponent.propTypes = {
isColorPicking: PropTypes.bool,
isFullScreen: PropTypes.bool.isRequired,
onDeactivateColorPicker: PropTypes.func,
onDoubleClick: PropTypes.func,
onQuestionAnswered: PropTypes.func,
question: PropTypes.string,
stageSize: PropTypes.oneOf(Object.keys(STAGE_DISPLAY_SIZES)).isRequired,
......
......@@ -7,6 +7,9 @@ import React from 'react';
* rendered by React. It's up to the containing component
* to retain a reference to the element prop, or else it
* will be garbage collected after unmounting.
*
* Props passed to the DOMElementRenderer will be set on the
* DOM element like it's a normal component.
*/
class DOMElementRenderer extends React.Component {
constructor (props) {
......@@ -23,17 +26,19 @@ class DOMElementRenderer extends React.Component {
this.container = c;
}
render () {
// Apply props to the DOM element, so its attributes
// are updated as if it were a normal component.
// Look at me, I'm the React now!
Object.assign(
this.props.domElement,
omit(this.props, ['domElement', 'children'])
)
);
return <div ref={this.setContainer} />;
}
}
DOMElementRenderer.propTypes = {
domElement: PropTypes.instanceOf(Element).isRequired
}
};
export default DOMElementRenderer;
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment