Created
August 22, 2019 10:15
-
-
Save rajgadade/7e55442478816adc52d450272944a460 to your computer and use it in GitHub Desktop.
reactjs function component with props demo
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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