react-scroll-to-component icon indicating copy to clipboard operation
react-scroll-to-component copied to clipboard

Uncaught TypeError: Tween is not a function

Open jeenacubet opened this issue 8 years ago • 8 comments

jeenacubet avatar Oct 06 '17 12:10 jeenacubet

Could be an issue when you are trying to use it with SSR (which it was for me.)

I just set it within the componentDidMount so it wasn't being executed on my node server. componentDidMount() { require("react-scroll-to-component"); }

If you are trying to use SSR, see this issue

nelKorajkic avatar Feb 09 '18 01:02 nelKorajkic

This lib is amazing. I just cant use since it break our tests though. The scroll-to fix PR is waiting to be merged since early 2016, which is very sad.

MarcoNicolodi avatar Mar 07 '18 20:03 MarcoNicolodi

Didn't work for me put the require on componentDidMount().

jorgeitenjr avatar Mar 08 '18 18:03 jorgeitenjr

@flyingant Any fix for the problem here? Seems like it has been broken for a lot of people?

oyeanuj avatar May 12 '18 13:05 oyeanuj

@oyeanuj I created another repo (https://www.npmjs.com/package/react-scroll-to-component-ssr) to replace the scroll-to dependency. But I dont really have too much experiences on server side rendering, can you have a look?

Thanks for the dependency from https://github.com/sashashakun/ssr-scroll-to cc @sashashakun

flyingant avatar May 14 '18 01:05 flyingant

Closed as resolved the issue from another NPM package for SSR

flyingant avatar Jun 06 '18 07:06 flyingant

I get this error when not server side rendering but when using jests to run my tests. I can solve it by mocking it out but would prefer not to, any ideas?

Ciaran0 avatar Sep 18 '18 10:09 Ciaran0

I was having trouble using this package because it fails during all of our jest tests. We bootstrapped our app with Create React App so we couldn't change the jest config. We solved the issue by adding a simple package mock in the setupTests.js file:

jest.mock('react-scroll-to-component', () => {
  return 'react-scroll-to-component';
});

All of our tests are now passing. Hopefully this helps anyone that runs into this problem.

jvillalobos22 avatar Apr 15 '19 16:04 jvillalobos22