feat: compatibility with latest versions of React and Next#55
feat: compatibility with latest versions of React and Next#55J3m5 merged 29 commits intodunglas:mainfrom
Conversation
…n project config environments use ts file for jest config, add types file for common types, improve types
…deStream data-reactroot attribute is not added on the root element since react 16 so it's no more needed to add add a root div to remove the attribute afterward improve types
…config, add prettier to eslint
return a React element instead of a string and remove div from esi:include tag improve environment checking in server.tsx
…ror.log files to gitignore
…ate deps update readme example links
|
Everything should be ok now @dunglas |
dunglas
left a comment
There was a problem hiding this comment.
So cool! I left some minor comments, and we'll be able to merge.
|
I've applied the remaining suggestions. |
|
Found this related issue: facebook/react#1444 |
|
The attributes from the generated html is indeed correctly escaped <div>
<h1>React ESI demo app</h1>
<esi:include
alt=""'<&Alt>'""
src="/_fragment?fragment=MyFragment&props=%7B%22greeting%22%3A%22Hello%21%22%2C%22esi%22%3A%7B%22attrs%22%3A%7B%22alt%22%3A%22%5C%22%27%3C%26Alt%3E%27%5C%22%22%7D%7D%7D&sign=c7102a792fa20beeb85c02081698c855c42f3cf575503202bbed224bce793845"
>
</esi:include>
</div>I think this is because we are not using renderToString or/and dangerouslySetInnerHTML anymore. |
|
As ESI is an XML vocabulary, using the long form instead of a self-closing element is most likely spec-compliant. |
The spec says
It doesn't say that it MUST NOT have a closing tag so, yes, we're probably good. |
|
Hi @dunglas |
|
This is whats output to the page in the express example so matches the spec as per your conversation previously. All tests are passing this looks great. Wish I'd have seen this PR before checking out main - doh! Excellent work! |
close #54, close #56