Giter VIP home page Giter VIP logo

Comments (8)

roginfarrer avatar roginfarrer commented on May 23, 2024

Hi @janhoogeveen, could you provide a codesandbox that reproduces this issue? Every instance of the component should have a unique id

from collapsed.

7iomka avatar 7iomka commented on May 23, 2024

https://github.com/roginfarrer/react-collapsed/blob/master/src/utils.ts#L132

I see the same issue, this is problem in SSR projects

from collapsed.

roginfarrer avatar roginfarrer commented on May 23, 2024

@7iomka @janhoogeveen Can you check if this PR fixes your issues? #54

from collapsed.

janhoogeveen avatar janhoogeveen commented on May 23, 2024

@roginfarrer How would I do that? If I try to install this with a github link in my package.json I'm getting duplicate react warnings.

from collapsed.

roginfarrer avatar roginfarrer commented on May 23, 2024

You can install specific branches, it's a pretty neat feature:

yarn add roginfarrer/react-collapsed#fix-unique-ids-on-first-render
npm install roginfarrer/react-collapsed#fix-unique-ids-on-first-render

from collapsed.

janhoogeveen avatar janhoogeveen commented on May 23, 2024

You can install specific branches, it's a pretty neat feature:

yarn add roginfarrer/react-collapsed#fix-unique-ids-on-first-render
npm install roginfarrer/react-collapsed#fix-unique-ids-on-first-render

I'll take a look, NPM is down right now but later today or tomorrow.

from collapsed.

janhoogeveen avatar janhoogeveen commented on May 23, 2024

When I remove my lockfiles and replace "react-collapsed": "^3.0.0" with "react-collapsed": "roginfarrer/react-collapsed#fix-unique-ids-on-first-render" in package.json I get the following error when trying to run my application:

Module not found: Can't resolve 'react-collapsed' in '/Users/jan/Projects/REDACTED/src/components/collapse'
Error: Hook can only be invoked from render methods.

    at Object.n.options.__h (/Users/jan/Projects/REDACTED/node_modules/preact/debug/dist/debug.js:1:6026)
    at v (/Users/jan/Projects/REDACTED/node_modules/preact/hooks/dist/hooks.js:1:152)
    at Object.s [as useReducer] (/Users/jan/Projects/REDACTED/node_modules/preact/hooks/dist/hooks.js:1:307)

I think this happens because the dist folder does not exist in my node_modules version of react-collapsed when I use the branch name to install it.

from collapsed.

roginfarrer avatar roginfarrer commented on May 23, 2024

I went ahead and merged and released the fix in 3.0.1, since it should be harmless. Let me know how it goes

from collapsed.

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.