Skip to content

Articles

I write some articles now and then. Whenever I have time and a topic to write about. Mostly about front-end development with React and Angular.

  • 4 min read

    In this article we'll learn how to write component stories in uncontrolled and controlled mode, that properly work together with args and controls in Storybook.

  • 6 min read

    Polymorphic React components are very common and useful, but also tricky to implement and limited in what type-safety they provide. We'll talk about the problems and see an alternative approach using an asChild prop.

  • 5 min read

    Reducers are not only useful for global state management. They can also be used for local component state. And compared to plain useReducer() we can reduce boilerplate code by adapting the API of modern reducer libraries like Redux Toolkit (RTK).

  • 9 min read

    In this article we'll build a styling foundation for a React application using vanilla-extract, a CSS-in-JS library. We'll create a global theme, a CSS reset, utility classes, a polymorphic box component and multi-variant components.

  • 6 min read

    Building complex reactive forms in Angular that require a lot of cross-field validation and triggering side effects isn't an easy task. In this article we'll see one possible way of building such a form using the form service approach.

  • 7 min read

    Every React project looks a bit different. There are so many ways to structure frontend projects. In this article we'll discuss three different project structures.

  • 9 min read

    Writing type safe code using TypeScript highly improves code quality and developer experience. But people often break out of type safety, writing code that isn't strictly type safe anymore. Here are a few tips & tricks for using TypeScript.

  • 11 min read

    Managing state in frontend application is hard. From local component state with performance issues to global state management with its own trade offs, there are many different ways for handling state. But is global state management really the right way to share state between components?

  • 11 min read

    Slots are a way to pass elements to a component and let them render in a specific location, like a header or footer. Let's find out how we can create a slot API in React.

  • 13 min read

    Angular Reactive Forms are great for building forms. For a large form it's often a good idea to split it up into multiple components. We'll find an easy and maintainable way to do that and we'll use strictly typed forms to make our approach type-safe.

  • 23 min read

    An Angular library lets you share code between multiple projects. For a larger library it's recommended to use subentry points. We'll build a new Angular library from scratch, add multiple subentry points with dependencies between them and add a showcase app that uses the library.

  • 6 min read

    React Hooks are great and I really miss them in Angular. What if Angular had hooks? We could build hooks for state management, subscription handling and even reactive state. So let's build Angular Hooks!

  • 12 min read

    Most translation libraries are focused on static text and do not allow you to build dynamic translations that include links and buttons - but this is a common use case. We'll build an Angular Component that lets you inject any HTML and even Angular Components and Directives into your translations.

  • 5 min read

    In a previous article we implemented a reactive form in Angular with child components. Now we'll learn how to initialize the form with data fetched by an API and how to convert the form values back to a data object.

  • 11 min read

    React accepts a single string as className. What if you want to set multiple classes or based on some condition? Let's build a utility function to make class names chainable, conditional and type-safe.

  • 7 min read

    Angular Reactive Forms are a great feature to build forms. When building a large form, you may want to split it up into multiple components. Let's see how this can be done in Reactive Forms. We'll take a look at different approaches and implement one of them.

  • 3 min read

    In React data flows one-way, from top to bottom. It does not support two-way data binding for good reasons. However, we can use Hooks to implement a pseudo two-way data binding.