Giter Club home page Giter Club logo

Comments (10)

ahmadzreqat avatar ahmadzreqat commented on June 15, 2024 31

not working with react dom v: 18

from react-snap.

Abhishek1350 avatar Abhishek1350 commented on June 15, 2024 3

It will work with react 18 use the following in index.js/main.js :

Screenshot 2023-11-06 125528

For me it was the problem with ReactDOM.createRoot so i replaced it with hydrate and render.
Note : By using this method your app will behave like react 17. In React 18, render was replaced by createRoot. Using render in React 18 will warn that your app will behave as if it’s running React 17. Learn more here..

Here is my package.json :
Screenshot 2023-11-06 125602

from react-snap.

jason-hwang avatar jason-hwang commented on June 15, 2024

Hi guys, Is there any updates for React 18?

from react-snap.

WillSmithTE avatar WillSmithTE commented on June 15, 2024

Aww sad to hear, I was about to try it out. Did you ever find a workaround or alternative?

from react-snap.

loganknecht avatar loganknecht commented on June 15, 2024

Encountering the same issue with this. 😭

from react-snap.

Abhishek1350 avatar Abhishek1350 commented on June 15, 2024

Aww sad to hear, I was about to try it out. Did you ever find a workaround or alternative?

#573 (comment)

from react-snap.

Nayem55 avatar Nayem55 commented on June 15, 2024

@Abhishek1350 Thank you . It works but the styles are broken . Do you have any solution for that?

from react-snap.

Abhishek1350 avatar Abhishek1350 commented on June 15, 2024

@Nayem55 Not sure about the broken styles, But you can try these steps.

  1. Try hosting you app in different platforms like vercel and netlify ( these are free ) and see if the issue is still there.
  2. If you are using an CDN then try to revalidate it's cache.
  3. Try this
    Ref : https://github.com/stereobooster/react-snap#readme
    Screenshot 2023-11-09 162835

Also when you deploy your app, check the page content by clicking on "view page source" in the browser. And see if you are getting the expected page content.

Apply these steps one by one and let me know what works!

from react-snap.

Nayem55 avatar Nayem55 commented on June 15, 2024

Okk .. I'll try this and let you know

from react-snap.

Rafaelceid avatar Rafaelceid commented on June 15, 2024

Hello Guys,, do we have any news about any update of this library? is it still compatimple with react 18?

from react-snap.

moretime-dev avatar moretime-dev commented on June 15, 2024

Hey guys, just had the same problem. Looking at the React 18 API Docu, I solved it like this and it works. Hope it helps.

const rootElement = document.getElementById('root') as HTMLElement

const root = ReactDOM.createRoot(document.getElementById('root') as HTMLElement)

const queryClient = new QueryClient()

if (rootElement.hasChildNodes()) {
  ReactDOM.hydrateRoot(
    rootElement,
    <BrowserRouter>
      <Auth>
        <React.StrictMode>
          <QueryClientProvider client={queryClient}>
            <App />
          </QueryClientProvider>
        </React.StrictMode>
      </Auth>
    </BrowserRouter>
  )
} else {
  root.render(
     <BrowserRouter>
      <Auth>
        <React.StrictMode>
          <QueryClientProvider client={queryClient}>
            <App />
          </QueryClientProvider>
        </React.StrictMode>
      </Auth>
    </BrowserRouter>
  )
}

from react-snap.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.