Skip to content

Conversation

alangpierce
Copy link
Contributor

JSX prop value strings are treated more like HTML strings than JavaScript
strings, so things like escape sequences don't work: it just uses a literal
backslash character. Also, if the string contains a " character, recast will
generate a double-quoted string with the " characters escaped, which isn't
valid for JSX prop strings. To fix, we wrap the string in curly braces if it
directly uses an escape sequence (i.e. the underlying code has a backslash) or
if it has a " character.

JSX prop value strings are treated more like HTML strings than JavaScript strings, so things like escape sequences don't work: it just uses a literal backslash character. Also, if the string contains a `"` character, recast will generate a double-quoted string with the `"` characters escaped, which isn't valid for JSX prop strings. To fix, we wrap the string in curly braces if it directly uses an escape sequence (i.e. the underlying code has a backslash) or if it has a `"` character.
@cpojer cpojer merged commit 84ef7b7 into reactjs:master Sep 26, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants