News for hackers. Stuff that matters.
Re:RawJS is a better way to call document.createElement() by spoiler on Thursday January 04, 2024 @09:17AM (#38867247)
The TS compiler might produce something, but that's not usually enough in the context of a larger React application (eg, they often import non-ts files).
Re:RawJS is a better way to call document.createElement() by throwitaway1123 on Thursday January 04, 2024 @05:15PM (#38873046)
> The TS compiler might produce something

It'll produce calls to React.createElement provided with: the tag name, props, and children. That's all JSX is.

> but that's not usually enough in the context of a larger React application (eg, they often import non-ts files)

React and JSX don't require you to import non-ts files. If RawJS's nascent ecosystem picks up momentum, people might start importing non-ts files in RawJS projects (e.g. css modules). My point is that there's nothing special about the RawJS api that allows you to skip a build step, and conversely, there's nothing about React that requires Babel (assuming you're already using TypeScript).