Skip to content

Instantly share code, notes, and snippets.

@palutz
Created August 11, 2017 16:57
Show Gist options
  • Save palutz/4e3871fedf2ac03b19ebb287cb35ed11 to your computer and use it in GitHub Desktop.
Save palutz/4e3871fedf2ac03b19ebb287cb35ed11 to your computer and use it in GitHub Desktop.
import React from 'react';
import ReactDOM from 'react-dom';
class Button extends React.Component {
render() {
return (
<button>
{this.props.text}
</button>
);
}
}
// defaultProps goes here:
Button.defaultProps = { text: 'I am a button'};
ReactDOM.render(
// <Button text="" />, / override the default props
<Button />, // use the default props
document.getElementById('app')
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment