question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[PSA] There's a known issue with react-helmet and useEffect

See original GitHub issue

Description

When using the new React API useEffect it causes a maximum call stack size exceeded error.

Steps to reproduce

Here’s a link to the issue on react-helmet https://github.com/nfl/react-helmet/issues/437

How to fix(?)

One of the suggestions is to upgrade to v6.0.0-beta

Possible bug

However, upon updating and running gatsby develop I ran into this issue

TypeError: Cannot read property 'renderStatic' of undefined
- render-page.js:1546 Object../node_modules/gatsby-plugin-react-helmet/gatsby-ssr.js.exports.onRenderBody

Does this mean we also need to update gatsby-plugin-react-helmet to use v6.0.0-beta as dependency?

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:10 (9 by maintainers)

github_iconTop GitHub Comments

2reactions
ryandrew14commented, Mar 27, 2019

Not too sure how to remove the stale label, but I submitted a PR #12873 yesterday, could somebody take a look?

1reaction
daydream05commented, Mar 6, 2019

Yup and here’s the fixed version with updated to v6.0.0-beta: https://codesandbox.io/s/01knpr64jn

That’s a great idea! The gotchas that I came up across with are:

After updating to v6.0.0.beta

  1. Make sure you have the latest gatsby-plugin-react-helmet
  2. Don’t forget to refactor import Helmet from 'react-helmet' into import { Helmet } from 'react-helmet'
Read more comments on GitHub >

github_iconTop Results From Across the Web

useEffect Hook not firing function enclosed inside it
I have the following component in my reactjs application ...
Read more >
When to Use and When to Avoid Using React Helmet -- newline
React Helmet is a library that helps to manage the document head in React applications. We can use it to change the page...
Read more >
A Critique of React's useEffect Hook - Alan Storm
The useEffect function is a React Hook. React Hooks only work with functional components. That is to say, React Hooks will NOT work...
Read more >
How to Use React Helmet – With Example Use Case
This is because react-helmet led to a few bugs that resulted in memory leaks and poor data integrity. Suffice it to say, when...
Read more >
Search-optimized SPAs with React Helmet - LogRocket Blog
This can be a significant issue for many developers. Server-side rendering (SSR) may solve this problem, but it has its limitations, too. React ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found