title: ReactJs: How to pass the initial state while rendering a component?
body: <p>I know I can pass <code>props</code> while rendering a component. I'm also aware of the <code>getInitialState</code> method. But the problem is, <code>getInitialState</code> isn't quite helping because my component doesn't know it's initial state. I do. So I want to pass it while I'm rendering it.</p>
  
  <p>Something like this (pseudo-code):</p>
  
  <pre><code>React.render(&lt;Component initialState={...} /&gt;);
  </code></pre>
  
  <p>I know I could use a <code>prop</code> to work as the initial state but this smells like an anti-pattern.</p>
  
  <p>What should I do?</p>
  
  <p><strong>EDIT FOR CLARITY</strong></p>
  
  <p>Imagine I have a <code>CommentList</code> component. By the time I first render it, the initial state corresponds to the snapshot of current comments from my database. As the user includes comments, this list will change, and that's why it should be a <code>state</code> and not <code>props</code>. Now, in order to render the initial snapshot of comments I should pass it to the <code>CommentsList</code> component, because it has no way to know it. My confusion is that the only way I see to pass this information is through a <code>props</code> which seems to be an anti-pattern.</p>