Uncaught TypeError: Tween is not a function
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
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.
Didn't work for me put the require on componentDidMount().
@flyingant Any fix for the problem here? Seems like it has been broken for a lot of people?
@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
Closed as resolved the issue from another NPM package for SSR
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?
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.