Skip to content

Instantly share code, notes, and snippets.

@dgellow
Created June 1, 2015 08:34
Show Gist options
  • Save dgellow/1aa76b1fb5c488cc9e42 to your computer and use it in GitHub Desktop.
Save dgellow/1aa76b1fb5c488cc9e42 to your computer and use it in GitHub Desktop.
// Load the default exported object from some modules
import React from 'react';
import Actions from './Actions.jsx';
import ProgressBar from './ProgressBar.jsx';
// Load all fns exported in a module
import * as api from './api';
// Load some fns exported in a module
import {decodeParams, pad} from './utils';
// Class exported as the default object.
// Can be loaded with `import Player from './filename'`.
export default class Player extends React.Component {
render() {
return (
<div><Actions/><ProgressBar/></div>
);
}
};
// private (not exported) Class with constructor
class ClickWrapper extends React.Component {
constructor(props, event) {
super(props);
this.state = {
event: event
};
}
handleClick(e) {
console.log('handleClick not implemented');
}
dispatch(eventName, obj) {
let event = obj ? new CustomEvent(eventName, {detail: obj}):
new Event(eventName);
dispatchEvent(event);
}
render() {
return React.DOM.span({
onClick: this.handleClick,
className: this.props.className,
dangerouslySetInnerHTML: this.props.dangerouslySetInnerHTML
}, this.props.children);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment