Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

From the post, it appeared to me as if this change was made, specifically, to remove the dependency on (importing) React. Are you sure that this results in making JSX dependant on React, instead?


Firstly, you're right that the main content of the post is re: not needing to import React. My comment was just pointing out that they have additionally changed the factory signature (an unrelated change).

Secondly, I should point out that JSX is currently not dependent on React. You can use JSX now without React, either via Typescript (built-in support) or via the custom `pragma` config key in babel's JSX plugin.

The change described in the article makes it unnecessary to import the full React lib into each component file when using JSX with React.

I'm not sure what the benefit of this is tbh...


You'll be able to tell babel to use a different "importSource" instead of `React`:

https://babeljs.io/docs/en/babel-plugin-transform-react-jsx#...


`importSource` is just a newer version of `pragma` (I mentioned above, listed on that page below `importSource`), and works fine right now without this new transform.


I was responding to this statement:

> The change described in the article makes it unnecessary to import the full React lib into each component file _when using JSX with React_.

`importSource` is more than just the new `pragma`, it also handles the fancy auto-import magic. This change makes it unnecessary to import your own custom lib (not just React) into each JSX file.


Ah ok, I get your meaning now. Yeah, it saves the need for the line in source code, but doesn't affect the generated code either way (you still need to include React somehow if using it, or whatever alternative if not)


You linked to the issue which appears to list the benefits of this. This is a stepping-stone change to: (from [0])

- Deprecate "module pattern" components. (ed: I don't know what this is)

- Deprecate defaultProps on function components. (ed: Presumably, allowing normal param default values instead)

- Deprecate spreading key from objects. (ed: Presumably, performance)

- Deprecate string refs (and remove production mode _owner field). (ed: unclear how this is related)

- Move ref extraction to class render time and forwardRef render time. (ed: presumably to make refs "just work" and not require the forwardRef rigamarole)

- Move defaultProps resolution to class render time. (ed: performance? not sure)

https://github.com/reactjs/rfcs/pull/107

[append]

Much better link: https://github.com/reactjs/rfcs/blob/createlement-rfc/text/0...


fwiw under old JSX you were always able to change the JSX pragma to any other library you wish, so i'd rate this no change in "degree of dependency on React" tbh.




Consider applying for YC's Fall 2026 batch! Applications are open till July 27.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: