Skip to content
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

Document justification for dangerouslySetInnerHTML={{__html: ...}} #2256

Closed
syranide opened this issue Sep 27, 2014 · 3 comments
Closed

Document justification for dangerouslySetInnerHTML={{__html: ...}} #2256

syranide opened this issue Sep 27, 2014 · 3 comments
Assignees

Comments

@syranide
Copy link
Contributor

From #1515 (comment)

@jimfb
Copy link
Contributor

jimfb commented Nov 13, 2014

cc @zpao

@syranide
Copy link
Contributor Author

@JSFB FYI, what I was referring to was the idea that {__html: } should preferably be considered a "type/taint" of sorts, to be used as function createMarkup() { return {__html: ''}; }; <div dangerouslySetInnerHTML={createMarkup()} /> and not for it to be created immediately inside dangerouslySetInnerHTML={{__html: ''}}.

The point being that if you unintentionally do say <div dangerouslySetInnerHTML={getUsername()} /> it will not be rendered because getUsername() would return a plain string and not a {__html: ''} object.

@jimfb
Copy link
Contributor

jimfb commented Nov 15, 2014

@syranide Great, thanks. Fixed in the latest version. Better?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants