If you want to automatically have your files expire (and get deleted) from DigitalOcean Spaces after a certain number of days, you can do it with s3 lifecycle rules. You can’t set this up in the web interface, so here's the code you need to create the rule using Node.js.
When you send a query string `req.query` back to Express, true and false booleans are converted into strings. Here's why, and how I parse them back to booleans - but only sometimes!
Here are three ways you can pass a function as a prop in React, with and without parameters - all while avoiding infinite loops!
In this blog post, I'll show you how to fix React rendering `0` in your `&&` conditions by using `!!` to convert it to a Boolean. But I'll also explain why it works so you can avoid this problem in the future!
Here's how I built a reusable pagination component with ReactJS, with next and previous buttons, that works with or without knowing the total number of pages available.
Paginating your data in MongoDB can be done in a single query, and it's kind of simple. But with this next page trick, you can know when you've fetched the last page of data, and avoid an empty results page.
Here's how I build a simple select all checkbox with React using the `useState` hook and lifting the state up out of the checkbox component. Now we can check all and uncheck all too!
If your React checkbox isn't working, or it takes two clicks to change the state, here are some common bugs and easy fixes!
Checkboxes are pretty common form elements, and in this blog post, I'll show you the two ways to check and uncheck a checkbox in ReactJS.
If you need to update your state when a prop changes, the easiest way to do this is React is with the `useEffect` hook. In this blog post, we will look at three options including `useEffect, the `key` prop, and removing state.
Ever wanted to use dynamic component names or use a variable to say which type of component or element you need? Let me introduce you to the `as` prop!
Dropdowns are a common UI element that your React app will (probably) need. Here's a simple ReactJS dropdown menu that you can use, with code examples and how I built it.
How can you `useRef` for multiple elements or inputs? What about adding new elements dynamically? Here's how you can create a `useRef` array or object for adding and removing multiple elements in your component.
Adding a custom subdomain to DigitalOcean Spaces can be a little tricky. Especially if you don't want to move your DNS or manage custom certificates. Here are a couple of workarounds I use.
One of the hardest parts of coding is when something just doesn’t work. And you don’t know why. In this blog post, I'll show you 6 ways to figure out why your code isn't working.
You can force ReactJS to remount a component using the `key` prop, resetting state, values, and data. The `key` prop can help you remount components on route URL and prop changes, and here's how I use this magical prop!
When you compare `ObjectId()`'s with the strict equality operator `===`, you might be surprised to get false, even when they match. It's caught me out a few times, so let's see how we can compare the MongoDB `ObjectId()`.