React Native (feat. Redux) React Native (feat. Redux)

Audience Questions: Redux Dev Tools, RxJS, and Redux Advantages

Check out a free preview of the full React Native (feat. Redux) course:
The "Audience Questions: Redux Dev Tools, RxJS, and Redux Advantages" Lesson is part of the full, React Native (feat. Redux) course featured in this preview video. Here's what you'd learn in this lesson:

Scott begins wrapping up the first day with some audience questions. He shares some thoughts on RxJS vs. Redux and talks about some of the advantages and disadvantages of Redux.

Get Unlimited Access Now

Transcript from the "Audience Questions: Redux Dev Tools, RxJS, and Redux Advantages" Lesson

[00:00:00]
>> [MUSIC]

[00:00:03]
>> Scott Moss: Let's walk through one more time, just to make sure. You just got, you just understand what it's doing. Because tomorrow we're gonna do asynchronous stuff and it's going to get pretty crazy when we start doing thunks. And stuff like that because we actually had to do that.

[00:00:17] So all we're, so basically yes?
>> Speaker 2: Asking if you can use the Redux dev tools.
>> Scott Moss: Can you use the Redux dev tools in Chrome during debugging?
>> Scott Moss: No I don't think so because I'm pretty sure the Redux dev tools rely on the dom although I could be wrong.

[00:00:39] Maybe they've modified it. I haven't used the Redux dev.tools in. I don't know so many months but last time I checked it was attached to the dom. So I don't know if you can use it. I think you mentioned earlier that dev tools would only really push people to Redux, are there any elements of it that give it a get a nice advantage over RX?

[00:00:56] Yes the dev tools for Redux when using the web are great, any other advantages given over RX? Yeah you don't have to learn RX, which is really hard. [LAUGH] He had to learn observables which is not the easiest thing to do at least it wasn't for me. Observables was a tough thing for me to understand whereas Redux is just JavaScript.

[00:01:14] So I think that's the best overhead. With RXJS, you have to really understand what you're doing to set up a structure similar to Redux because Redux is like here. It's the only way to do it because RX, like you could mess up and have like the worst architecture ever or the best, it depends on how brilliant you are.

[00:01:33] Can you describe in a few words what the advantages about using Redux, okay? But it's predictable, we can actually predict our state or it's like, if you have local state and like 2A data binding like for instance inside of a component. It's gonna be really hard to predict where the state is, what's happening.

[00:01:52] Where it's being mutated, where it's not being mutated, whereas Redux is actually really easy. The only way to modify a state is to fire an action. And then only in our reducers are we changing the state. So as we can actually kind of understand what's happening where a state and because everything is all the state is changed by an action.

[00:02:09] We get a timeline of every single thing that's happening in our application, which is why Redux can like travel through time which is like one of the big selling points. You can go back in time and undo the state like go back to the previous state in your app which means you're walking back in time in your application.

[00:02:22] And that's what the dev tool does, it's actually pretty cool. I would highly recommend checking it out using a Redux app on the web. It's like if this thing pop open and you can this time travel through your app. It's really great for debugging too, I've actually used it in production to track what users were doing when an error happened.

[00:02:38] Go look at the logs in the Redux and I can see exactly what actions they did. I can go back all the way to what they were doing like this is where it fell. So it's pretty pretty good to do that.
>> Scott Moss: Nice. Yeah, and testing is easy too because they are just pure functions, no side effects.

[00:02:55] So you can test pretty easily. Any more questions on this stuff? Okay, so-
>> Speaker 3: What are the tricky parts of the downfalls of that approach, from your perspective, you're talking about advantages but, disadvantages.
>> Scott Moss: Yeah, this advantages is tons of border plate like if you look at this reducer here.

[00:03:18] This is actually just a small reducer. I've written apps with reducers are like, I don't know, just huge, huge reducers doing all types of creative stuff. And there's so much boilerplate because you'd be having the producers doing the same thing. So you find yourself trying to make like these methods that do try to take care of all the cases for if all your reducers.

[00:03:36] So a lot of boilerplate, tons of boilerplate. You have to be really good organization, like for instance, I always find myself typing out these action names sometimes and I'm like what is going on and it kind of breaks. The other thing for me which is the biggest for me I would say is like Redux doesn't handle side effects at all.

[00:03:57] A side effect is, so I want this action to happen. So when it's action fires, I want something else to happen. Like I want some asynchronous thing to happen. So when I add a post I also want to go ahead and make this call to the analytics TV or something like that and Redux doesn't really handle that for you at all.

[00:04:13] There is no story for that. You gotta do it yourself so that kind of sucks for me. Whereas I want to be able to describe side effects when certain actions happen. And that's just not there..And then the configuration is kind of tough I guess..You have to do a lot of things like connecting it with the connect and all types other stuff like that.

[00:04:34] So there's a lot of configuration, a lot of boilerplate, no support for side effects and yeah, those are the downsides for me. Yeah, and the types making sure that they're all the same other than that it's pretty good. It's still one of the best things out there as far as state management goes for sure.

[00:04:53] But if you know RXJS I recommended just using RXJS. If you don't know observables use Redux. I want to go over the stuff we did today and get a chance to ask questions and then kind of go over the thing were gonna build tomorrow. We're gonna be building a fitness app tomorrow.

[00:05:08] An app that your, it's actually gonna look pretty good. You could probably like put in the app store. It's gonna be like a really good looking app, it's really dope. It's called Sweatbook. It's gonna be amazing. [LAUGH] Yeah, Sweatbook, but, yeah, so now, let's just go over all your questions for today specifically because tomorrow we're gonna just, we're gonna hit the ground running.

[00:05:27] Believe it or not, most of the stuff that you learned today is pretty much already. There are some like APIs that we haven't used but the API is a read the documentation like that's nothing. But most of the basic concepts for what you know now. You can actually build an application because it's just, it's literally just the components, these components with whatever JavaScript you want to use for state management or whatever.

[00:05:50] But it's literally just these components. And how React works. Everything else is just JavaScript.