On React Hooks [1]

From thine unblessed classes thou shalt depart:
For syntax sugar doth thine eyes sweeten,
Yet they are but functions cold to thy heart,
Barriers bitter to unenlightened.
Fear not that this transition be fateful,
For thou of thy new State Hooks canst make use,
And thy components may still be stateful.
None but hatred, if thou makest more excuse.
How to send my requests? Mayst thou well ask.
What in vulgar days when he her did mount,
Effect Hooks, all in one, do sweetly mask.
Or thou mayst complain 'bout old code amount:
Shouldst thou this day manage the transition,
Morrow thou shalt save thyself frustrations.

Paraphrasing and explanations:
You should not use classes any more;
Because although 'class' as syntax sugar can look nice,
It only creates functions(objects) in JavaScript, nothing new,
And poses barriers to new learners.
Don't fear that the transition to Hooks will turn out bad,
Because you can use the new State hooks,
And your component will still be stateful.
If you find more excuse about not using it, you are just hating.
How to send my requests? You may ask.
We used to use the function componentDidMount()[2],
But now we can use the integrated Effect hooks.
Or you might complain about the amount of old code (written in classes),
But if you make the transition today (to Hooks),
Tomorrow you will save yourself frustrations.


  1. Major revision needed. This was among my first sonnets - virtually everything breaks in it.

  2. "He her did mount" serves as a "vulgar" pun reminiscent of that in The Da Vinci Code by Dan Brown:
    Driver: (while Robert is thinking about Vittoria Vetra) Did you mount her? ("Her" referring to the Eiffel Tower).
    Used here as a funny reference to the React API's name.