Listing 4-25: Rendering a NavBar inside of App
function NavItem(props){
return (
<button onClick={props.onClick}>Click Me</button>
)
}
export default NavItem;
function NavItem(props){
return (
<button onClick={props.onClick}>Click Me</button>
)
}
export default NavItem;
function NavItem(props){
return (
<button onClick={props.onClick}>Click Me</button>
)
}
export default NavItem;
import NavBar from './NavBar';
import NavItem from './NavItem';
function App(props){
return (
<NavBar onClick={()=>{console.log('clicked');}}>
<NavItem />
<NavItem />
<NavItem />
</NavBar>);
}
export default App;
Download the examples, report issues, and ask/answer questions in the discussion area by visiting the book's github page. All of the code for the book is also available on codesandbox.io for you to play around with.
ReactJS Foundations is published by John Wiley and Sons, Inc and is available in paperback and eBook.