Listing 6-15: A component without default props
37.3230
122.0322
37.3230
122.0322
import Map from './Map';
import StoreList from './StoreList';
function StoresNearYou(props){
return(
<>
<div id="map-container">
<Map
latitude={props.latitude || "37.3230"}
longitude={props.longitude || "122.0322"}
/>
</div>
<div id="store-list">
<StoreList
latitude={props.latitude || "37.3230"}
longitude={props.longitude || "122.0322"}
/>
</div>
</>
)
}
export default StoresNearYou;
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.