-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Usage of renderToStaticMarkup from react-dom/server in react Text component bloats client filesize #107
Comments
@morbidick Yes it is, but it allows to use React components as parameters for |
@pret-a-porter That's actually an issue for vite for example, having |
@pret-a-porter Right, but that component won't have access to things like context, because it's rendered in isolation. That feels like a pretty big footgun. |
Make sense, issue reopened |
AFAIK the "proper" way to handle it is to make Text return a fragment, and let react handle the rest. So, something like the following: // messages: { hello: 'Hello, {name}. Nice to meet you!' }
// a Text like this:
<Text id="hello" name={<SomeComponent />} />
// should output (return) this:
<>{"Hello, "}<SomeComponent />{". Nice to meet you!"}</> |
Unfortunately it does not cover case, when string contains html tags. React fragments does not support |
yes, html strings would probably need to be parsed into a react tree (a la |
Hi, thank you for this nice and small translation library.
In commit 3c1d0a0
renderToStaticMarkup
fromreact-dom/server
was introduced to the Text Component, unfortunately that leads to the inclusion for react-dom-server in the client build and bloating the filesize.The text was updated successfully, but these errors were encountered: