Closed rjungbeck closed 1 month ago
Hey @rjungbeck, thanks for posting. Looks like someone else filed a very similar issue and i happened to respond there first. Let's continue discussion at https://github.com/facebook/react/issues/29136#issuecomment-2117899444. I'll close this just to avoid duplicates, thank you again for reporting!
I was trying to port a bigger existing code base to react-compiler.
I ran about the issue, that react-compiler requires all expressions used in event handlers to be always resolvable (even if the handler itself can not be reached in some cases).
Here is a very simplified sample:
Replacing console.log(data.id) with console.log(data?.id) resolves the issue. But this would of course require to manualy find and update all of the affected handlers.
Wouldn't it be better if react-compiler uses the ?. instead of . for the dependencies?