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
<FormattedMessage> unexpectedly preserves whitespace for its props #104
Comments
Nothing special is happening here, elements passed as props simply become children. Are you sure this isn't a JSX thing preserving the source's whitespace when passing an element as props to another component? |
Good call, I just tried this out with a different component and it seems to have the same behavior. |
I think the problem might be in Babel. babel/babel#1276 |
[Doc] Travis badge should be pointing to master
* chore(babel-plugin-react-intl): add more test to enforceDefaultMessage * fix(intl-utils): fix tests
Normally, if I have this code:
React will render something like this in the DOM:
Now, if I pass that same JSX to
<FormattedMessage>
like this:then something like the following is rendered for the
thing
prop:In many scenarios this might only introduce a single space of unexpected whitespace which usually won't be a deal-breaker. However, if you are using this in conjunction with a style like
white-space: pre-line;
it can really break the UI.It would be better if the props that are passed in to
<FormattedMessage>
were rendered with the same rules that React uses.The text was updated successfully, but these errors were encountered: