Accepted answer

You could use the mapStateToProps function to query the store when you connect the component to redux:

import React from 'react';
import { connect } from 'react-redux';
import _ from 'lodash';

const Foo = ({ item }) => <div>{JSON.stringify(item)}</div>;

const mapStateToProps = (state, ownProps) => ({
  item: _.find(state, 'id',

export default connect(mapStateToProps)(Foo);

(This example uses lodash - _)

The mapStateToProps function takes in the whole redux state and your component's props, and from that you can decide what to send as props to your component. So given all of our items, look for the one with the id matching our URL.


import _ from 'lodash'; const mapStateToProps = (state, ownProps) => ({ item: _.find(, (e) => e.product_id == ownProps.match.params.productID) });

Here product_id is a label present in the API, and productID is the parameter I gave in the react-router.

ATTENTION: do not forget the match keyword

Related Query

More Query from same tag