Wednesday, March 25, 2020

Road Rash 3 guide

One of my favorite childhood games was Sega Genesis’ Road Rash 3. I ended up downloading Fusion emulator during corona virus pandemic, and of course I resurrected Road Rash 3, among others.

To my joy, I found a comprehensive guide for Road Rash 3, with amazing detail, which was finished in 2009, 11 years ago, by some good people. So far I’m having a lot of fun exploring it.

Monday, March 16, 2020

Choosing between useState and useReducer in React

Right now I’m designing a rather important architecture at work, and I’m using React for it. After writing a simple enough implementation with Redux, I came to the conclusion that, in fact, I don’t need Redux in this architecture, since I’m only storing auth information. Context API seems to be enough.

So, in order to have a mutable and reactive value in the application context, I must choose between useState and useReducer hooks.

While studying the matter, I found a rather good answer to this question:

  • When it’s just an independent element of state you’re managing: useState;
  • When one element of your state relies on the value of another element of your state in order to update: useReducer.

Although the examples given by the author are way too long, the idea is spot on. In my particular case, since the state is just a monolithic block of data, useState seems to fit my needs.