Keep your FE dumb!

Try to keep your client as dumb as possible, to achieve this you should avoid the following: In many cases your service layer can take the heavy lift away from the FE which takes away complexity/ risk and avoids duplicating/ mutating business logic + domain sources of truth.

Javascript – hoisting

Recently I had to refactor a very large react class component into a function component, the overall goal was to keep the business logic the same, but add thourough typing so the risk of regressions from a much larger refactor later would be lower. I ran into a problem with this, it seemed at first… Continue reading Javascript – hoisting

React Testing Lib – don’t misuse act

After reading this article you should checkout other common mistakes using RTL here: https://kentcdodds.com/blog/common-mistakes-with-react-testing-library Ever noticed this warning in your tests? Noise like this in test runs can be really annoying, and if we read the error in a bid to find out how we might get rid of it, we might think – well… Continue reading React Testing Lib – don’t misuse act

React – consider styled components

Instead of having css (or equivalent) files, considering having styled components. There is serious value to taking this approach as it results in a much more contextualised styling system. Let us first take the following example that does not leverage this approach: In file SomeComponent.tsx in file styles.css notice that these two units of code… Continue reading React – consider styled components

Published
Categorized as React

React – recommended packages

This post will be a work in progress, but for now I want to start with two great packages. The first is react-hook-form, this is one of the best packages I have used in recent years, out of the box it provides some great hooks and also a global context which allows your form components… Continue reading React – recommended packages

Published
Categorized as React