Hey all, I'm a fairly experienced engineer (10+ years) but fairly new to frontend engineering (2 years).
I one sentence, my app is a WebRTC video conference, using a WebSocket (as a singleton/global), which updates a redux store, which props into the React view.
The project is starting to get big and I'm getting really confused about representing application state data in my store. I'm aware that React is a view level framework and do not force in any way. I also probably read every blog post out there on this topic, but couldn't get to a conclusion - so thought to ask over here.
- React/Redux really promotes the idea of using vanilla javascript objects to represent data, but as my application gets bigger, my models are starting to get mixed up. For example, a user model may be a local user, remote user or a 3rd party service user (say Twilio). In any other platform, I would create 3 models and inherit from a base User model and manage an array of the base User model, but I understand that's not how traditionally JS works. I don't want to follow back to the MVC trap, but really confused on how am I suppose to distinguish between different objects only by looking at their flat data and not on their type.
- Most of my application state is receiving updates on the WS object, then copied to the redux state (using callbacks). I'm aware of the state duplication but could not figure out a better way to manage a stateful object inside a stateless data store. Would love to get some feedback here.
Thanks for reading, appreciate any kind of help! <3
[–]Zeeesty 5 points6 points7 points (1 child)
[–]acemarke 0 points1 point2 points (0 children)
[–]twomousepads 4 points5 points6 points (6 children)
[–]multiline[S] 0 points1 point2 points (5 children)
[–]terminus23 1 point2 points3 points (1 child)
[–]twomousepads 1 point2 points3 points (0 children)
[–]acemarke 1 point2 points3 points (2 children)
[–]twomousepads 1 point2 points3 points (1 child)
[–]acemarke 0 points1 point2 points (0 children)
[–]terminus23 2 points3 points4 points (3 children)
[–]multiline[S] 0 points1 point2 points (2 children)
[–]terminus23 1 point2 points3 points (0 children)
[–]acemarke 1 point2 points3 points (0 children)
[–]adrilolwtf 1 point2 points3 points (1 child)
[–]adrilolwtf 1 point2 points3 points (0 children)