Month: March 2022
-
What is a stateless component in React?
Stateless components in React are components that don’t manage data. For example, a stateless component might render the same thing each time, like a logo…
-
Where should functions in function components go?
It is technically possible to define functions inside functional components as in the following example: The main issue with the above example is that myInsideFunction…
-
Conditional rendering in React
Conditional rendering is the act of showing/hiding your elements/components based on the state of your application. Just like in any framework/language this can be done…
-
onClick with a parameter in React
It can be difficult to understand just how to pass a parameter to a React function from an onClick call, and it can even be…
-
Injecting singletons into your React components
Sometimes you’ll need to use the singleton pattern in your applications and there is an easy way to inject these into your React components. This…
-
Where is this (default) prop coming from?
This post is just a quick refresher for the times when you might find yourself mystified as to where a component is getting a certain…
-
Code splitting with lazy and Suspense in React
Knowing how to split your code with Suspense and lazy was discussed in a previous post. In short, you need to dynamically import your component…