Blog
-
Combining data with multiple fetch requests
Published on 25 Jul 2023
I was recently working on a project where I needed to make multiple API calls to create a combined array of data. It is very easy to get into a mess with a task like this. For those that find themselves in a similar position, the solution I went with looks like this:
-
A React Query gotcha
Published on 14 Jun 2023
I’ve been working on a project that uses React Query and I came across a bug caused by the data on the page being reset when coming back to the browser after focusing another window. Upon investigation I discovered that there is a flag enabled by default called
refetchOnWindowFocus
which does what it says on the tin. -
Find a git commit from the command line
Published on 22 Mar 2023
When I’m working in a codebase I sometimes need to find a previous commit. Until recently I would either do a
git log
or view the history in GitHub, but sometimes the commit might be buried under a sea of commits and be difficult to find. -
Declarative and imperative programming
Published on 09 Mar 2023
You may have come across the terms declarative and imperative programming, but aren’t sure what they mean. If you’ve been writing a code for a reasonable amount of time, you most likely know these concepts, you just don’t know what they’re called.
-
They say that gear doesn’t matter, but it does
Published on 05 Mar 2023
I’ve been practicing photography seriously for around ten years, and one thing I have always been told is that gear doesn’t matter. One thing I have learned in that time is that this is not an absolute. The gear doesn‘t matter, but it also does.
-
Git commit messages: Why or what?
Published on 09 May 2022
I’ve always been told that when writing a git commit message, it should explain the why rather that the what behind the changes. The reasoning is that a reviewer can see what you have done by looking at the code, but they have no context as to why. My thoughts on this are that it should explain the what, especially if you work with pull requests.
-
React lazy state initialization
Published on 08 May 2022
The simplest way to set the initial state of a React component is to pass a value directly to the
useState
hook. -
Understanding the useState syntax in React
Published on 05 May 2022
If you have started a new React application recently then you have probably been introduced to hooks. By far the most commonly used hook is the useState hook.
-
Five years from now
Published on 17 Nov 2021
How many times have you been asked where or what you’d like to be in five years from now? It’s something I’ve been asked in interviews and self-assessments countless times.
-
Thoughts on JavaScript style guides
Published on 13 Nov 2021
When reading this weeks issue of JavaScript Weekly I found a link to Airbnb’s latest JavaScript style guide.
- 1
- 2