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.

[9.0.0-beta.34] destructuring in useTransition does not work in build

See original GitHub issue

🐛 Bug Report

@react-spring/web and react-spring builds are behaving strangely and giving errors where they didn’t previously

When importing @react-spring/web from codesandbox, I see this error $csb__animated.extendAnimated is not a function

Switching to react-spring I see this error from useTransition Cannot destructure property 'ref' of 'props' as it is null.

To Reproduce

Basic useSpring/useTransition usage with 9.0.0-beta.34

Link to repro (highly encouraged)

Basic useTransition show/hide @react-spring/web 9.0.0-beta.34 https://codesandbox.io/s/quiet-cloud-sill4?file=/src/App.js

Basic useTransition show/hide react-spring 9.0.0-beta.34 https://codesandbox.io/s/blazing-fast-w529r?file=/src/App.js

I’ve noticed this has completely broken my library react-spring-lightbox https://codesandbox.io/s/react-spring-lightbox-mosaic-71hts?fontsize=14&module=/src/ImageGallery/index.js&file=/src/ImageGallery/index.js

Environment

  • @react-spring/web v9.0.0-beta.34
  • react v16.13.1

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:11 (5 by maintainers)

github_iconTop GitHub Comments

37reactions
Yzrsahcommented, Mar 24, 2021

@tim-soft The API for useTransition changed in V9 but it’s not documented on react-spring.io. If you make these changes, it will resolve the issue.

  • Remove the key selector from useTransitions(), as it’s now automatic: const transitions = useTransition(toggle, null, { to const transitions = useTransition(toggle, {

  • Call transitions instead of mapping it: transitions.map(({ item, key, props }) => ...) to transitions((props, item, key) => ...)

@joshuaellis The issue is just a documentation issue.

3reactions
kennycrosbycommented, Nov 20, 2020

Getting the same error here with ^9.0.0-rc.3, using the example pulled right from the docs. Any advice?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Error when destructuring values from useContext in TypeScript
Destructure the value only after it has been checked for not being null : const MintNFTForm = () => { const ctxt =...
Read more >
Open Source Used In Intersight Mobile App 1.0.172 - Cisco
This document contains licenses and notices for open source software used in this ... of this License, Derivative Works shall not include works...
Read more >
Destructuring Props in React - Medium
Destructuring was introduced in ES6. It's a JavaScript feature that allows us to extract multiple pieces of data from an array or object...
Read more >
https://135.181.40.220/Integreat/react-sticky-head...
_result:null)return ge(e)}return null}function ye(e){var t="";do{e:switch(e.tag){case 3:case 4:case 6:case 7:case 10:case 9:var n="";break e;default:var r=e ...
Read more >
Overzealous Destructuring | Aleksandr Hovhannisyan
When you destructure arguments in JavaScript, you don't have to repeat yourself like you do here: const function = (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