Simulating a Goldfish Brain with React

Have you ever wondered what it would be like to be a goldfish with a 5 second memory?

Probably not.

However, I needed to start learning React so here is my first effort. It’s a variation of the “to-do list” which every beginner programmer does. Albeit, with the slight idiosyncrasy that all your to-do items will vanish after 6 seconds.

A pic from the Goldfish Brain Simulator project
Click to visit: https://whitelightninggun.github.io/goldfish/

By far the most interesting part of React for someone like me is that it obliges you to think in terms of asynchronous operations. This obviously creates the potential for a much more interactive, even “app-like” web page. Which of course is whole point of React.

That said, there is something left to be said for code blocks that look like this:

function removeThought(thoughtIdToRemove) { 
    setThoughts(thoughts => thoughts.filter((thought) => thought.id !== thoughtIdToRemove ));
  }

Stuff like that is going to become confusing and maybe even hard to debug in a large project, I clearly see why Typescript was invented now.

Examine the source here.