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

Popover content not rendered as HTML when stored in variable #1308

Closed
wphampton opened this issue Sep 9, 2015 · 2 comments
Closed

Popover content not rendered as HTML when stored in variable #1308

wphampton opened this issue Sep 9, 2015 · 2 comments

Comments

@wphampton
Copy link

Any ideas why the HTML content won't render properly in my Popover component if I first store the value in a variable?

This does not work:

var popContent = '<strong>Holy guacamole!</strong> Check this info.';
var popover = <Popover title="Popover right">{popContent}</Popover>;

return ( 
    <OverlayTrigger trigger='click' rootClose placement='right' overlay={popover}>
      <Button bsStyle='xsmall'>Holy guacamole!</Button>
    </OverlayTrigger>
);

Because it generates this:
2015-09-09 16_26_41-specimen tracker

While this does work:

var popover = <Popover title="Popover right"><strong>Holy guacamole!</strong> Check this info.</Popover>;

return ( 
    <OverlayTrigger trigger='click' rootClose placement='right' overlay={popover}>
      <Button bsStyle='xsmall'>Holy guacamole!</Button>
    </OverlayTrigger>
);

2015-09-09 16_24_09-specimen tracker

Thanks -- I'm stumped!

@taion
Copy link
Member

taion commented Sep 9, 2015

That's not the way JSX variables work. You'd want e.g.

var popContent = <span><strong>Holy guacamole!</strong> Check this info.</span>

@aterreno
Copy link

Not sure why @taion reply got a downvote, that's exactly why the popup doesn't get the html styling, you need a jsx variable

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

No branches or pull requests

3 participants