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
In these modern times when we commonly transpile our frontend javascript (which we have to do anyway to go from jsx -> h()) we might as well produce template strings or string concatenation code from the JSX/TSX source code instead of calling into a "JSX reviver" like stringjsx at runtime.
The only thing that needs to be shipped at runtime from the stringjsx package would be the sanitization logic.
To illustrate, the transpiler would (in the most basic case) take this:
constuserProvidedText='i am very smart';constmyHtml=<div><spanclass="comment-header">Comment</span><p>{userProvidedText}</p></div>
and turn it into this:
import{sanitize}from'stringjsx';constuserProvidedText='i am very smart';letmyHtml='';myHtml+='<div>';myHtml+='<span';myHtml+=' class="comment-header">';// ... etc snipmyHtml+='<p>'+sanitize(userProvidedText)+'</p>';myHtml+='</div>';
The text was updated successfully, but these errors were encountered:
In these modern times when we commonly transpile our frontend javascript (which we have to do anyway to go from jsx ->
h()
) we might as well produce template strings or string concatenation code from the JSX/TSX source code instead of calling into a "JSX reviver" like stringjsx at runtime.The only thing that needs to be shipped at runtime from the stringjsx package would be the sanitization logic.
To illustrate, the transpiler would (in the most basic case) take this:
and turn it into this:
The text was updated successfully, but these errors were encountered: