0

Does somebody know about a Helmet in ReactJS (https://github.com/nfl/react-helmet). I try to use Helmet for google seo.

<Helmet>
    <meta charSet="utf-8" />
    <title>My Title</title>
    <link rel="canonical" href={process.env.PUBLIC_URL} />
</Helmet>

Why comes mistakes in console?

enter image description here

Taylor Burke
  • 424
  • 4
  • 15
user2301515
  • 4,903
  • 6
  • 30
  • 46

1 Answers1

0

componentWillMount has been deprecated.

These methods are considered legacy and you should avoid them in new code:

Taylor Burke
  • 424
  • 4
  • 15
  • componentDidMount which comes later in the lifecycle can be used https://reactjs.org/docs/react-component.html#componentdidmount – Taylor Burke May 29 '20 at 19:04
  • However, I would recommend getting familiar with the new Hooks API. Lifecycle methods can be confusing and the trend in React development is to generally use Hooks instead, whenever possible. https://reactjs.org/docs/hooks-overview.html#state-hook https://overreacted.io/a-complete-guide-to-useeffect/ – Taylor Burke May 29 '20 at 19:07
  • Can somebody give an example. These materials are too much difficult to understand. I can read by working helmet-using example only. – user2301515 May 29 '20 at 19:23
  • what are you trying to accomplish with your lifecycle method? – Taylor Burke May 29 '20 at 19:30