You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
importReact,{Component}from'react';import{Link}from'react-router';classCarextendsComponent{render(){// Get data from route propsconstcars=this.props.route.data;console.log(`cars = ${cars}`);console.log(`cars[0] = ${cars[0]}`);console.log(`cars make = ${cars[0].make}`);console.log(`cars price = ${cars[0].price}`);console.log(`cars make = ${cars[1].make}`);console.log(`cars price = ${cars[1].price}`);// Map through cars and return linked carsconstcarNode=cars.map((car)=>{return(<Linkto={"/cars/"+car.id}className="list-group-item"key={car.id}>{car.name}</Link>)});return(<div><h1>Cars page</h1><divclassName="list-group">{carNode}</div></div>);}}exportdefaultCar;
Object.size=function(obj){varsize=0,key;for(keyinobj){if(obj.hasOwnProperty(key))size++;}returnsize;};// Get the size of an objectvarsize=Object.size(myArray);
browserHistory
https://reacttraining.com/react-router/web/api/history
https://github.com/ReactTraining/history#blocking-transitions
https://github.com/ReactTraining/history
Pushes a new entry onto the history stack