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.

Was getState() replaced or removed; is it now built in behavior?

See original GitHub issue

Trying to continue using window.snapSaveState = () => getState(); with the new version @loadable/components, and it seems to not be a module export anymore.

I have a purely static react app and have been using react-snap in conjunction with your guy’s beautiful getState 😃

How should I continue to maintain this functionality with @loadable/components?

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:12 (4 by maintainers)

github_iconTop GitHub Comments

4reactions
stereoboostercommented, Dec 14, 2018

Here are options for anyone who will face this issue:

2reactions
stereoboostercommented, Dec 9, 2018

If we would drop the tone, there is a sense in those words.

Alright let’s be realistic and don’t expect real help free labor from react-snap and from loadable-components people on the internet who don’t owe you anything.

Yes, this is open source. People provide you with results of their labor for free without any warranty or further promises. You can use, you can skip it. It is up to you.

If you want to create a pre-rendered static website with dynamic loading don’t waste spent your time (sad but true…): just leave loadable-components and react-snap and go something like Gatsby.js.

Right, and you can spend your time to learn GraphQL (which is good in long-term, I guess, but will slow down you in the beginning) and spent some time writing transformation layer from the existing data source to Gatsby’s GraphQL.


Gatsby is a great tool and if you can use it (like you already know how to use it), go ahead and use it. From my experience, it has some barrier for novice users, like GraphQL and a need to write custom plugins to work with your data.

React-snap is for a different purpose, it is for the case when you already have some codebase and don’t want to invest time to rewrite in Gatsby or react-static or …

As of loadable-components, I use the previous version which has getState(). My hope is that eventually we will not need any external solution and will be able to use React.lazy, which is not the case right now.

I tried:

const RootApp = (
  <ConcurrentMode>
    <Suspense fallback={<div>Loading...</div>} maxDuration={5000}>
      <App />
    </Suspense>
  </ConcurrentMode>
);

if (rootElement.hasChildNodes()) {
  ReactDom.hydrate(RootApp, rootElement);
} else {
  ReactDom.render(RootApp, rootElement);
}

and

const root = ReactDom.unstable_createRoot(rootElement);
root.render(<Suspense fallback={<div>Loading...</div>} maxDuration={5000}><App /></Suspense>);

The code above results in white flash (blink), but logically it shouldn’t

Read more comments on GitHub >

github_iconTop Results From Across the Web

Redux Fundamentals, Part 4: Store
The store has the current state value and reducer function inside of itself. getState returns the current state value. subscribe keeps an array ......
Read more >
Wrong React hooks behaviour with event listener
This is a common problem for functional components that use the useState hook. The same concerns are applicable to any callback functions ...
Read more >
Working with entity states - EF6 - Microsoft Learn
Deleted entities are deleted from the database and are then detached from the context. The following examples show ways in which the state ......
Read more >
Authentication State Persistence | Firebase - Google
Supported types of Auth state persistence; Modifying the Auth state persistence; Overview of persistence behavior; Expected behavior across browser tabs.
Read more >
How to Manage State in a React App – With Hooks, Redux ...
In modern React, we build our applications with functional components. ... a React component re-render (the other is a change in props).
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