Commit d8a153e9 authored by leoa's avatar leoa
Browse files

Customize page so that it passes through the url the pokemon id

parent 2906e28e
import React, { Component } from 'react';
import { browserHistory } from 'react-router';
import logo from './logo.svg';
import './App.css';
import Pokemon from "../Pokemon";
......@@ -8,7 +9,14 @@ class App extends Component {
let pokemons = [];
for(let i = 1; i < 10; i++)
{
pokemons.push(<Pokemon idPokemon={i.toString()} key={i}/>)
pokemons.push(
<div onClick={() => browserHistory.push('/detail_page/' + i.toString())}>
<Pokemon
idPokemon={i.toString()}
key={i}
/>
</div>
)
}
return(pokemons)
}
......
......@@ -7,8 +7,8 @@ import DetailPage from './components/DetailPage';
const Routes = (props) => (
<Router {...props}>
<Route path="/" component={App} />
<Route path="/detail_page" component={DetailPage} />
<Route path="/detail_page/:idPokemon" component={DetailPage} />
</Router>
);
export default Routes;
\ No newline at end of file
export default Routes;
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment