Skip to content

Instantly share code, notes, and snippets.

@aerrity
Created January 30, 2018 22:06
Show Gist options
  • Select an option

  • Save aerrity/4747b644e781cf254340a93deb9841bd to your computer and use it in GitHub Desktop.

Select an option

Save aerrity/4747b644e781cf254340a93deb9841bd to your computer and use it in GitHub Desktop.
React props example
import React from 'react';
import ReactDOM from 'react-dom';
function NameLength(props) {
return <h1>The name {props.name} contains {props.name.length} characters!</h1>;
}
function App() {
return (
<div>
<NameLength name="Johnny" />
<NameLength name="Gillian" />
<NameLength name="Jordan" />
</div>
);
}
ReactDOM.render(
<App />,
document.getElementById('root')
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment