Where to put UI side affects code in vuex or redux?

Viewed 64

I am using a third party webrtc library to achieve video call functionality.

In the library, there are APIs to get a "stream" object. Once I get that (via a call back from the library), I can call stream.showInElement("#someElement") to display it on the page.

I wonder how this piece of code fit in Vuex - Where should I put them?

The first option is inside the actions. But ideally actions should be completely separate from the components.

I guess another way is to keep the stream object in the store?? But is store allowed to keep a complex object? I remember in redux we do Object.assign({}, state) all the time, I don't think that stream object can be copied simply that way.

Thanks

0 Answers
Related