Category Archives: frontend

Convert react/redux webapp from saga/axios to RTK query and RTK listener

Redux saga is a core component of my react/redux applications. Unfortuately Redux Saga has been deprecated and haven’t seen an upgrade in the last year.

This blog posts covers the replacement of redux saga and axios with RTK query and RTK listener in a react redux webapp.

Continue reading Convert react/redux webapp from saga/axios to RTK query and RTK listener

Convert react app built with frontend-maven-plugin from webpack to vite

The frontend-karaf-demo project is a maven project that builds a jar file containing a servlet and compiles a react application, with frontend-maven-plugin, into static files that can be added to the jar file’s classpath and be served by the servlet.

With the frontend-maven-plugin, building a webapp can be integrated into a maven build, without the builder having to download and install node.js. The frontend-maven-plugin downloads its own node.js to handle npm depdencies and do the build.

This bloggpost describes the things I had to do, to convert the webapp build in this setup from webpack to vite.

Note: to follow this recipe npm must be installed (but it is possible to achieve the same effects by manually editing package.json). Continue reading Convert react app built with frontend-maven-plugin from webpack to vite

Trying out Tailwind CSS on a react webapp

Introduction

On November 11 2021 I put trying out tailwindcss on my personal TODO list.

In January 2024 I got around to trying out tailwindcss on a react.js web application and this blogpost first describes how I used it and then what I think about it.

The application used in the tailwind test

The test bed for trying out Tailwind CSS was my smallest real application, handlereg. This is an application for tracking grocery purchases. What’s tracked for each purchase is the date, the store and the amount.

Before trying out Tailwind CSS, the application was styled with Bootstrap v5 (and just recently upgraded from Bootstrap v4).

Here is the main page of the handlereg webapp styled with Tailwind CSS. Continue reading Trying out Tailwind CSS on a react webapp

Yep, I’m still using redux

Why I’m still using redux and how I’m currently using redux.

One thing I’ve heard a lot recently, when other frontend people have taken a look at my code, is the question “Are you still using redux? That’s so wonderfully quaint and old fashioned. When we threw it out and started using useState() hooks our life got so much better!” (or maybe just “once we started using hooks our life got so much better”).

And yep, I am still using redux, even though react hooks, which supposedly made redux obsolete and old-fashioned, arrived back in 2018 (which is also the same year I started doing frontend programming).

Continue reading Yep, I’m still using redux

Replacing react-datepicker with HTML input element of type date

I replaced “react-datepicker” in two of my react applications, with the built-in <input type=”date”/> date picker, and the resulting reductions in bundle.js size were so significant I felt the need to blog about it.

Continue reading Replacing react-datepicker with HTML input element of type date

A Java programmer’s guide to delivering webapp frontends

When I started investigating (googling) web frontends, I found tutorials for various frameworks and I found tutorials using node.js to deliver frontends to web browsers on localhost.

What I did not find, was something telling me how I should pack up and deliver the webapp frontend from my production system, so that comes here:

  1. A web application frontend  is a piece of javascript code, that builds its user interface by rebuilding the DOM tree of the webpage that loaded it
  2. The javascript needed for a webapp is packaged up as a big javascript file, typically named bundle.js,
  3. The initial HTML file references bundle.js
  4. The initial HTML file also contains an element that matches what the javascript code expects to be its start element (i.e. the point in the DOM of the parsed HTML file, where the javascript program starts rebuilding its own DOM)

Continue reading A Java programmer’s guide to delivering webapp frontends