React-helmet: Not clear what's change from v5 to v6

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

Documentation update request

The readme still refers to 6.0.0-beta not 6.0.0. The compatibility section mentions that Helmet 5 is backward compatible but doesn't mention Helmet 6.

The compatibility section also says "We encourage you to update your code to our more semantic API".

Which is great but I don't understand what is meant by that!

What is the new semantic API and how does it differ from the old API. I actually want to know because I'm trying to update existing code to use the latest Helmet 6 package, and it seems like updating the API usage is a good thing to do at this time.

Most helpful comment

The main thing is you have to do a named import now for Helmet which is a breaking change:

import { Helmet } from 'react-helmet';

but yes the docs should be updated as 6.0.0 is now stable.

All 12 comments

The main thing is you have to do a named import now for Helmet which is a breaking change:

import { Helmet } from 'react-helmet';

but yes the docs should be updated as 6.0.0 is now stable.

@lannonbr Thanks.
Could you also tell me what the "more semantic API" means? Maybe 1 simple example of old non-semantic vs new semantic?

Thanks @lannonbr that's definitely a breaking change that needs to be adhered to.
@mlippert we, unfortunately, were not able to deprecate the old API, so you can still use it. In a future version, we'll get rid of the Helmet component that takes all the metadata as props and just have Helmet be a component that takes html tags as children (it's more semantic):

<Helmet>
  <title>My Title</title>
  <meta charset="UTF-8" />
</Helmet>

And thanks, we do need to update the README and docs to call out this valuable information.

Thanks @cwelch5 that's sort of what I thought but I'm much happier not guessing.

Our code does pass the metadata as props, but now that I understand that's the "old" way, I'll update our code so we'll be ready for future updates on your part going forward!

Also might I suggest/request that if you put nothing else in your CHANGELOG.md that you have a _Breaking Changes_ section under new major versions. It's helpful if you are updating from very old code (I'm not at this time but I have for other packages) that is more than 1 major version out of date.

Thank you @mlippert makes sense.

Thanks @cwelch5 that's sort of what I thought but I'm much happier not guessing.

Our code does pass the metadata as props, but now that I understand that's the "old" way, I'll update our code so we'll be ready for future updates on your part going forward!

Also might I suggest/request that if you put nothing else in your CHANGELOG.md that you have a _Breaking Changes_ section under new major versions. It's helpful if you are updating from very old code (I'm not at this time but I have for other packages) that is more than 1 major version out of date.

Ditto, to me as a user, it is very concerning having a package with a breaking change (or any change, for that matter) and absolutely no indication as to what those change(s) may be. It seems like this package in general does a poor job of communicating changes to users, which is surprising from a package with 1m+ weekly downloads.

Still, unanswered question, what is this "new semantic API"?

Is it by any chance

<Helmet
      meta={[
        { name: 'description', content: 'Sample' },
        { name: 'keywords', content: 'sample, something' },
      ]}
>

instead of putting <meta name="..." content="..." /> tags in <Helmet> ? I saw this used in the Gatsby default starter, but not documented in this project's README.

@dandv no reference at hand, yet I believe it's actually the opposite and by semantic they mean more HTML like.

@lannonbr Is it really a breaking change though?

export default HelmetExport;
export { HelmetExport as Helmet };

So yes they did add back the default export alongside the named export in 6.1.0, but 6.0.0 only had the named export which was breaking which was the reasoning behind the major bump to 6

Ahh... Gotcha

Was this page helpful?
0 / 5 - 0 ratings

Related issues

brianespinosa picture brianespinosa  路  3Comments

brokentone picture brokentone  路  4Comments

jineshmehta16 picture jineshmehta16  路  3Comments

michaelBenin picture michaelBenin  路  3Comments

lyquocnam picture lyquocnam  路  3Comments