You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
JSX preserve mode: make is not a valid component name #7432
I'm not sure if this is worth fixing. I believe it should be addressed at its root; the functionality of createContext should be different, in my opinion.
Activity
nojaf commentedon May 6, 2025
Hmm, the current React create context approach feels like a departure from the norm. It seems more like a workaround than a suitable solution.
React.createContext(0)should create a module withProviderandConsumer, butReact.Context.providerreturns a component definition.To better fit into the existing component flow, it could be structured like this:
I'm not sure if this is worth fixing. I believe it should be addressed at its root; the functionality of
createContextshould be different, in my opinion.nojaf commentedon May 6, 2025
Something along these lines would fit the current flow better:
cknitt commentedon May 6, 2025
That may be a better/more idiomatic API. Also note this change in React 19 BTW: https://react.dev/blog/2024/12/05/react-19#context-as-a-provider
However, even with different context bindings, couldn't there be other similar situations where one ends up with
<make ... />?cknitt commentedon May 6, 2025
E.g., simple case, when not using the PPX transform:
compiling to
Is emitting
makeinstead ofX.makehere maybe an optimization that could somehow be disabled in this case (within JSX)? @cristianoccknitt commentedon May 17, 2025
A workaround for the above problem is to always use
@react.componentWithPropswhen not using@react.component.But I still think we need a proper fix.
Another case where it occurs is when using
React.memofollowing this pattern:producing
@cristianoc Do you have an idea how we could prevent this?
cristianoc commentedon May 17, 2025
Not sure
cometkim commentedon May 23, 2025
The easiest fix is probably emitting an alias where the code uses jsx.
nojaf commentedon May 23, 2025
Any pointers on how to do that? It would be nice if we could indeed alias to something uppercase.