Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[compiler] InlineJSXTransform transforms jsx inside function expressions #31282

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

josephsavona
Copy link
Contributor

InlineJSXTransform wasn't traversing into function expressions or object methods, so any JSX inside such functions wouldn't have gotten inlined. This PR updates to traverse nested functions to transform all JSX within a hook or component.

Note that this still doesn't transform JSX outside of components or hooks, ie in standalone render helpers.

InlineJSXTransform wasn't traversing into function expressions or object methods, so any JSX inside such functions wouldn't have gotten inlined. This PR updates to traverse nested functions to transform all JSX within a hook or component.

Note that this still doesn't transform JSX outside of components or hooks, ie in standalone render helpers.
Copy link

vercel bot commented Oct 17, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
react-compiler-playground ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 17, 2024 5:59pm

Comment on lines +161 to +167
t0 = () => ({
$$typeof: Symbol.for("react.transitional.element"),
type: Child,
type: "div",
ref: null,
key: "a",
props: props,
};
$[0] = props;
key: "d",
props: { children: props.foo },
});
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this wasn't transformed before

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed React Core Team Opened by a member of the React Core Team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants