Making React Titles Easier to Read

Making React Titles Easier to Read

M. Zakyuddin Munziri

M. Zakyuddin Munziri

@zakiego

Originally written in Bahasa Indonesia.

Introduction

Let's get acquainted with React Wrap Balancer. In short, this library helps make titles more pleasant to read. How does it work?

Before

After

Notice how the word "meeting" that was previously alone on its own line is no longer isolated. The text composition becomes more evenly distributed.

As stated in its documentation,

"React Wrap Balancer avoids single hanging word on the last line"

Discussion

Actually, you don't have to use the React Wrap Balancer library. Another approach is to use the CSS text-wrap: balance property, but you need to be careful because not all browsers support this feature yet.

Therefore, it's safer to use React Wrap Balancer. It will use text-wrap: balance when possible, and if not, it will use its own method.

How to Use

First, install the library. Oh, and don't forget to use pnpm.

pnpm add react-wrap-balancer

# or

npm install react-wrap-balancer

# or

yarn add react-wrap-balancer

Import the library.

import Balancer from "react-wrap-balancer";

Finally, wrap your text inside <Balancer>.

<h1>
  <Balancer>Humans Are Forgetful, Take Notes of Your Meetings</Balancer>
</h1>

This library is not limited to titles only; it can also be used for other tags as needed.

More Articles

I Stopped Digging Through Logs

I Stopped Digging Through Logs

Debugging changed when I stopped reading logs manually and started using AI agents to correlate errors across observability data - faster root cause, fewer dead ends.

Speed Was Never the Hard Part in CI CD

Speed Was Never the Hard Part in CI CD

Fast pipelines don't eliminate shipping fear. Confidence comes from safe rollbacks, feature flags, and systems that behave predictably when things go wrong.