September Pop In: React Tidbits

September Pop In: React Tidbits

Hi All,

Just wanting to say hi while we’re in September. It’s been pretty busy at work and with Ellie being schooled again. ‘Twas the longest spring break ever. . . I’ve been doing a lot of work in React recently , which sometimes feels like, “yes, I’ve got this!” Then I have to deal with modifying state and then it’s all, “NOPE. What the world in the heck is going on??”

Here are a few of my observations with React after muddling around in it a while.

  • Why does wrapping my component in <> and </> magically make it work??
    • Turns out it’s called a React Fragment and it’s for letting you return multiple children without jacking things up. Please see link for less janky explanation.
  • Why is testing it so convoluted?
    • This is probably on me. I’m getting better at some parts of testing React, but it’s still mysterious.
    • It seems like you want to test the workflow rather than if X == Y specifically. So like if you click a button you want to make sure that when you do click it, all the things you want called and done are actually called and done.
    • Mocking is your friend and don’t try to test too much in one component. So if your component is calling a permission checker, only test up to the point where the permission checker is called and that you do call it. Then test the specifics of the permission checker in a new test.
  • State variables are cool, but it’s kind of tricky to debug them.
    • Just go and read about State Hooks. I don’t have a super firm grasp on it yet, so this here is mostly reference for me.

React isn’t really one of the things that I thought I’d be learning, but here we are and while parts of it are fine (I’m better at writing components) other parts are still just tricky to deal with (adding in redux for one). BUT! I’m learning and getting better at it and my goal is to not have to ask questions about the same thing over and over, which I hope I’m accomplishing.

More next time!

-Rachel

The Art of Being Stuck on a Problem

The Art of Being Stuck on a Problem

Hey All! It’s been crickets on here for a bit, but there really hasn’t been a lot of inspiration recently. July has been nice and we were able to go on a bit of a vacation with family which was enjoyable. My work computer has decided to reboot itself and install updates, so here we are.

I’ve been stuck on a problem for a few days now. It’s a frontend problem (React/Redux) which I’m still quite unfamiliar with. All my normal guys I’d go to for asking questions to are on vacation this week. I’ve been poking around and trying to figure it out for the past day or two. I know what I need to do, but am still really unsure as to how I need to go about what I need to do, if that makes sense. Anyhoo, it has gotten me thinking about how I really dislike being stuck on a problem, but also reflecting on what is good about being stuck on something.

Being stuck on a problem forces you to learn more about the problem. I don’t know everything, but I wish I did. Not being able to solve something right away confronts that little tidbit head on, unfortunately. So it leads me on over to the internet to look up documentation and articles. I read and I learn more.

Not having your normal go-to question people around also encourages you to branch out from them and to interact with other people to help you solve your problem. I’ve gotten a chance to chat with a couple of other co-workers with knowledge on the subject matter and it’s been enjoyable. I don’t love branching out because I have my circle-o-friends and that’s just fine for me. But not having them available kind of forces my hand to branch out, and it’s really not bad. (I hope this doesn’t make me sound terrible)

I know I’ll get it solved and will learn more from it. So don’t get discouraged when you aren’t able to solve something right away. It’s good to struggle and think and ask for help. I don’t like admitting to struggling and needing help, but it’s good and allows one to grow and learn more.

Now that we’re on the downward slope of summer, I hope to write a bit more. We’ll see. More next time!

-Rachel