Example: I have a Prosemirror editor, and I want to track the current doc as state. Problem is, if I pass down the `doc` as the initial state, if forces the editor to get recreated on every key stroke 😬
I added the compiler, and it somehow sorted out all the memos for me!
I also wanted to store that editorView as state by calling `setEditorView`. Unsurprisingly, this caused an infinite render loop... until I flipped on the compiler. Solved that for me too 🤯
Is it possible to back port these changes to your source code? Or out in another way - can the compiler be used to teach yourself how to write better React code?
I'll admit I'm a little uncomfortable knowing my code won't function *unless* the compiler is involved. But if the compiler is the new normal, does it really matter?
How has the debugging experience been so far? When you step debug in the browser, do you see your own original code, the compiled code, or some intermediate?
This is sorta my take on it too. I'd love to use it since it will make me have to write less boilerplate code, but I'm kind of afraid that it will make me sloppier with the best practices I employ, if I can just get used to thinking, "Well, the compiler will clean it up, somehow."
But it's still like a version of the Svelte 3 compiler where instead of optimizing what is reactive it tries to optimize what is not reactive, which is a much more complex job
So there are still some common cases where it is not possible to optimize and some gotchas that disable optimization
To me the very idea feels defeating, which I know is counterintuitive. But I want get on board and try it because who wouldn’t want to choose doing less work.
Comments
I added the compiler, and it somehow sorted out all the memos for me!
So there are still some common cases where it is not possible to optimize and some gotchas that disable optimization
haven't tried react compiler until now