Enterprise Architecture Patterns Immutable Store Practice
Transcript from the "Immutable Store Practice" Lesson
>> I think at this point we probably have a good idea of what i'm hinting at in terms of what we're building. Not a super surprise. We're just incrementally plodding along. And we are going somewhere with this. And so if I go and I look for, I'm going to take my clients store and I'm going to just move this down here.
[00:00:36] And I'm going to make a couple changes to this. I'm going to add in a reducer property. I'm going to reduce her parameter. And so when you create the store it's also going to take reducer this reducer equals. And then from here, we're going to add in one more method and it's going to be dispatch.
[00:01:20] Which is going to take an action. And I can even strongly type this if I so desire. And now this state equals this dot reducer this dot state action. Now, within this I'm going to send in the clients reducer and let's try something out. So const I might have already done this.
[00:02:04] Let me see, I'm just gonna a client equals and we're gonna go. Clients store, select. Current client. And I'm gonna save this, and then I'm gonna go down here. Let's just dump this out. And just resize this so we can see it. As expected, we're getting the current client.
[00:02:41] So now let's go back up here. And let's dispatch an action. So store dispatch. Hold on, client store, dispatch. And we're going to set in a type of client, select And we're going to send in a payload Of, Let me create a new client real quick. Const. Who am I into right now?
[00:03:47] Well, [BLANK AUDIO]The most unoriginal I totally got stage fright. Not really but[BLANK AUDIO] when your ID equals 1234 first name Shane Last name, though. Company is a non. All right. So now I'm going to say I want to create a new client and so I did select let me do CLIENT_CREATE.
[00:04:41] There we go. And I'm going to send in a new client and then from here what I wanna do. Is I want to go All clients equals client store select clients. I'm going to go ahead and save this. And I'm going to go down here and we're going to trace this out.
[00:05:13] I really hope that when I move this back that we have.