Mmanishjha-04

preact/X/props-children-to-child-array

No description available

Legacy
preactXmigration
Public
0 downloads
0 stars
How to Use
Run this codemod on your codebase using one of the following commands

The easiest way to run this codemod without installing anything globally:

Documentation

A codemod that enhances child handling in Preact components by using toChildArray for accurate child count.

Detailed description:
This codemod refactors Preact components to improve the handling of props.children. It introduces the toChildArray utility from Preact, ensuring that child elements are accurately counted, especially when dealing with fragments or nested arrays. This leads to more robust and predictable behavior in your components.

Example

Before

ts

After

ts

Ready to contribute?

Build your own codemod and share it with the community.