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.

React.Lazy component with other exports do not get refreshed

See original GitHub issue

If I have a component on the default export loaded lazily I am unable to see any refreshes if I also have any named exports.

const Component = lazy(() => import('./AComponent'))

The same component import normally will refresh as expected.

import Component from ./AComponent'

export const myNamedExport = {
  one: 'one'
}

export default function AComponent() {
  return <p>hello</p>;
}

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:12 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
pmmmwhcommented, Mar 1, 2021

Should be fixed in 0.5.0-beta.1.

0reactions
frehnercommented, Jan 26, 2021

Hm, I discovered that my situation is actually different than this one and am trying to narrow it down again. [edit: opened #299 ]

(A minimal repo I was using helped me discover the causes above, but it turns out my app’s problems were actually different than the minimal repo’s problems. 🙂 )

Read more comments on GitHub >

github_iconTop Results From Across the Web

React.Lazy component with other exports do not get refreshed
If I have a component on the default export loaded lazily I am unable to see any refreshes if I also have any...
Read more >
Lazy loading React components - LogRocket Blog
Named exports for React components. At the moment, React.lazy() does not support using named exports for React components.
Read more >
React.lazy without a default export - DEV Community ‍ ‍
The React.lazy function lets you render a dynamic import as a regular component. Before: import OtherComponent from '.
Read more >
Lazy loading React components with React.lazy
Take any component that you want to lazy load and change it to the following: - import MyComponent from './MyComponent'; + const MyComponent ......
Read more >
Lazy Loading React Components (with react.lazy and suspense)
It is a new function in react that lets you load react components lazily through code splitting without help from any additional libraries....
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