I have a simple navigation bar use case where I have
Components
- NavBar.jsx
- NavBarItem.jsx
Stores
- NavStore.js
Using Dependencies
- React
- Reflux
I'd render the navbar like
<NavBar active={itemName} itemList={itemList} />
The question is my initial state is {}, so is my NavStore, since there's no external data involved, how should I initialize the NavStore.js with itemList information?
I tried to add a helper method on Store like initializeData(data), and call it in NavBar Component's render or getInitialState(), it somehow is always getting called after a this.setState() on Component and reinitialized store with initial values. Not sure why getInitialState() always get called on this.setState().
I am also using Reflux as the action dispatcher but I am seeing the getInitialState() called on every action. It seems a bit odd. Does Reflux trigger a recreation of component by default?