Recent Posts
Context Refactor
Intro to React Context Intro to React Context, and how to do a quick refactor of an existing useState hook.
Niche? Not really - read on for a quick intro to how to use React Context to share and manipulate data across an app.
You might be designing an app from first principles, or being the lucky duck to architect something very neat and clean from scratch.
But, let’s say you’re doing something else - what if you’re dealing with a pretty big project, and you realize suddenly that you want to share some state across the whole project?
read more
VS Code Extensions
This can get a bit personal, but maybe I can suggest to you some useful VS Code extensions that I’ve installed and found really helpful.
VS Code Extensions for Javascript and Web Development I’ve been using VS Code for web development for a year. Along the way, some extensions have been really useful, and I’d like to catalogue that.
Obviously, you might find some other extensions that you think are really useful, especially if you’re using other languages or other frameworks.
read more
React Hooks - Loading Data with useEffect and useState
Using React Hooks for Fun and Profit Let’s say you realize that you want to get something from a database via the API. You know, like a useful website often does.
You want to display the results too, and you’re using React on your front end.
First, get a useState hook running to have a place to store the results of your API call:
import React, { useEffect, useState } from 'react'; const [content, setContent] = useState(''); Then get a useEffect hook running to load the data in asynchronously:
read more