Novice.
I am using react-redux and want to pass an Id value to another page.
I have a URL that supplies the "Id" value (eg 1029 as below) which I want to use in an action that has a fetch statement, again which utilises this "Id" value.
I cant seem to pass this "Id" value through to the compnentDidMount() function...
The URL looks like this:
My routes.js looks like this:
import React from 'react';
import { Route } from 'react-router';
export default
<Route component={Layout}>
<Route path='/' components={{ body: Home }} />
<Route path='/clients/edit/:id' components={{ body: EditClient }} />
</Route>;
It successfully matches the route with ":id" and lands on the "EditClientContainer" Page.
...which has the function
componentDidMount() {
this.fetchClient(id)
}
and the "fetchClient" function directly under it:
fetchClient = (id) => {
this.props.requestClient(id)
}
I want the "id" from the URL to form the "Id" parameter in fetchClient.
How do I get the (in this case 1029) to become the parameter in fetchClient via the function "componentDidMount()"?