React-helmet: Usage with react-intl

Created on 12 Apr 2017  路  7Comments  路  Source: nfl/react-helmet

I suggest, that this should be allowed

<Helmet >
   <FormattedMessage {...msg.title}>
      {title => <title>{title}</title>}
   </FormattedMessage>
</Helmet>

What do you think?

Most helpful comment

You can simply switch things around:

<FormattedMessage id="msg.title">
  {title => <Helmet><title>{title}</title></Helmet>}
</FormattedMessage>

All 7 comments

Thanks for your interest in Helmet.

You can see an explanation here - https://github.com/nfl/react-helmet/issues/262#issuecomment-291000077

You can also use the injectIntl HoC and do intl.formatMessage() in your component instead.

@cesarp Yes, I know that. I just prefer less imperative approach.

@cwelch5 By the way, just FYI https://twitter.com/dan_abramov/status/855872355406671872 ))

You can simply switch things around:

<FormattedMessage id="msg.title">
  {title => <Helmet><title>{title}</title></Helmet>}
</FormattedMessage>

You can simply switch things around:

<FormattedMessage id="msg.title">
  {title => <Helmet><title>{title}</title></Helmet>}
</FormattedMessage>

Thanks @fxlemire , it works!

You can simply switch things around:

<FormattedMessage id="msg.title">
  {title => <Helmet><title>{title}</title></Helmet>}
</FormattedMessage>

save my day! kkk

Was this page helpful?
0 / 5 - 0 ratings

Related issues

MiguelMachado-dev picture MiguelMachado-dev  路  4Comments

RichardJECooke picture RichardJECooke  路  4Comments

tiagonapoli picture tiagonapoli  路  3Comments

mattecapu picture mattecapu  路  4Comments

namnm picture namnm  路  4Comments