title: Pass object through Link in react router
body: <p>I found this question, which describes exactly what I was looking for...</p>
  
  <blockquote>
    <p><a href="https://stackoverflow.com/questions/31168014/pass-object-through-link-in-react-router">Pass object through Link in react router</a></p>
    
    <p>Is it possible to pass an object via Link component in react-router?</p>
    
    <p>Something like:</p>
  </blockquote>
  
  <pre><code>&lt;Link to='home' params={{myObj: obj}}&gt; Click &lt;/Link&gt;
  </code></pre>
  
  <blockquote>
    <p>In the same way as I would pass props from the Parent to Child component.</p>
    
    <p>If it's not possible what is the best way of achieving this:
    I have a React + Flux app, and I render the table with some data. What I am trying to do is when I click on one of the rows it would take me to some details component for this row. The row has all of the data I need so I thought it would be great if I could just pass it through Link.</p>
    
    <p>The other option would be to pass the id of the row in the url, read it in the details component and request the data from the store for by ID.</p>
    
    <p>Not sure what is the best way of achieving the above...</p>
  </blockquote>
  
  <p>I agree with the author's conclusion, meaning: instead of passing an object, we should pass an id. I am however struggling with where on the next component I should perform that lookup, possibly in an onload method where I define mapDispatchToProps.</p>
  
  <p>However, I don't know how to access the state from there to see if the object is in the state so I can retrieve it from an api call if it isn't in the state. Does that belong here or in the action? If it is in the action, how do I get it there. This seems like it would be a very basic pattern and I am missing something.</p>