erikras / react-redux-universal-hot-example

A starter boilerplate for a universal webapp using express, react, redux, webpack, and react-transform
MIT License
12k stars 2.5k forks source link

Add property to store in Server.js #1251

Closed sauravskumar closed 8 years ago

sauravskumar commented 8 years ago

How can we add a property to store in server.js... Can anyone please help me with this? I wan to add a value to store just upon render in server.js... (I think it maybe via calling a dispatch on server.js but i am not exactly able to do it..)

jboonmee commented 8 years ago

You may want to try the 3rd parameter on the createStore(history, client, {myData: 'Hello'}. Or, you might want to take a look at redux/create.js.

sauravskumar commented 8 years ago

@jboonmee adding 3rd parameter to create store did not work... but i make a simple function to dispatch an event right in server.js and that worked.. thanks for reply... sever.js store.dispatch({type: 'app/IS_MOBILE', mobile: mobile}); and just catch the event as usual in redux/modules/*.js

case IS_MOBILE: return { ...state, mobile: action.mobile };