Closed jcd79 closed 8 years ago
I will add an example to make this more clear.
In the mean time, you are probably missing a reducer. You are correctly sending the state to the client, but when that state is passed to the store and an action is finally dispatched, the data is dropped off because it wasn't handled by a reducer.
You will want to modify the reducer.js file to handle someData
.
If you notice, there is temp
property on the state. Notice a few things on it.
StateViewModel
here so that controllers can set it.state.temp.{property}
I am using the temp
state for any random data that I need sent to the server, but I don't want to do the entire plumbing because it doesn't really do anything advanced. I will probally replace this temp
state with a viewBag
, that will be populated from MVC using the ViewBag
. This will give users ability to send generic data to the client that doesn't really transform via reducer actions.
If you need to send some custom state to the client and reducer actions need to be performed on it, then you will want to setup a reducer specifically for the data, such as the auth.js.
You are correct though. There needs to be clear documentation for this. I will create a Wiki page going through this. I will ping this ticket when I am done. I'll get to it this weekend.
Update! I pushed an example to help you get started!
This example is in the empty-template branch. Look specifically at commit a39add4.
I've started working with you template.
It's not completely clear for me how it's supposed to work with GET calls and pre-rendered data.
I've made it work like this - but it feels somehow awkward.