Use "React.Fragment" to render flushed components without "span"#53
Use "React.Fragment" to render flushed components without "span"#53kettanaito wants to merge 1 commit intofaceyspacey:masterfrom kettanaito:react-fragments
Conversation
…nents without redundant "span"
|
Thanks for this. I'm hesitant to merge it just yet. Are you using it successfully? It may make more sense along side a larger release in the future. Regarding the white space, I'm pretty sure that's Jest's doing, as I never edit the files directly. Perhaps prettier or eslint formatting. |
|
@faceyspacey Thanks for the reply. |
|
cool! |
|
Hi @faceyspacey , is there a plan to merge this PR? I'm very much interested in this change. For now I forked your repo and made "span -> React.Fragment" myself (published repo is here https://www.npmjs.com/package/webpack-flush-chunks-with-fragment). So far it works for me! |
Changelog
createApiWithCssnow returnsJs,StylesandCssReact components usingReact.Fragmentto render their children without a wrapping<span>createApiWithCsssnapshot changed according to the changes in the source fileBenefits
spanwhich shouldn't wrap<link>or<script>elementsConsequences
Side notes
I've thought about this change and introduced a small pull request to cover it. I am not very familiar with Jest and its snapshots system, so you better check if I changed the snapshots correctly.
By the way, not a very good idea to include whitespaces as a part of a snapshot. Some IDE remove trailing whitespaces automatically, which causes snapshots to fail. You may want to consider removing whitespaces.