Skip to content

Instantly share code, notes, and snippets.

@rajgadade
Created August 22, 2019 10:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rajgadade/7e55442478816adc52d450272944a460 to your computer and use it in GitHub Desktop.
Save rajgadade/7e55442478816adc52d450272944a460 to your computer and use it in GitHub Desktop.
reactjs function component with props demo
const todos = [];
todos.push("Buy a big doll");
todos.push("Do yoga");
todos.push("Review component article");
function TodoList(props) {
return (
<div className="todo-lists">
<h1>TodoList</h1>
<ul>
<li>{ props.data[0]}</li>
<li>{ props.data[1]}</li>
<li>{ props.data[2]}</li>
</ul>
</div>
);
}
function App() {
return (
<div>
<TodoList data={todos}/>
</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