stephane-monnot / react-vertical-timeline

Vertical timeline for React.js
https://stephane-monnot.github.io/react-vertical-timeline/
MIT License
1.07k stars 158 forks source link

Error typescript #83

Closed jhimelymendoza closed 3 years ago

jhimelymendoza commented 3 years ago

Hi, I was testing the component with the example you have in the docs, and I get this error:

Warning: Cannot update a component (VerticalTimelineElement) while rendering a different component (InView). To locate the bad setState() call insideInView, follow the stack trace as described in https://fb.me/setstate-in-render in InView (created by VerticalTimelineElement) in VerticalTimelineElement (at Jobs.tsx:10) in div (created by VerticalTimeline) in VerticalTimeline (at Jobs.tsx:9) in section (created by styled.section) in styled.section (at Jobs.tsx:8) in Jobs (at MainLayout.tsx:15) in MainLayout (created by Context.Consumer) in Route (at App.tsx:21) in Switch (at App.tsx:19) in Router (created by BrowserRouter) in BrowserRouter (at App.tsx:17) in Suspense (at App.tsx:16) in App (at src/index.tsx:12) in IntlProvider (at WrapperLang.tsx:48) in Wrapper (at src/index.tsx:11) in StrictMode (at src/index.tsx:10)

my environment is the following reactjs "@fortawesome/fontawesome-free-solid": "^5.0.13", "@fortawesome/fontawesome-svg-core": "^1.2.32", "@fortawesome/free-brands-svg-icons": "^5.15.1", "@fortawesome/free-solid-svg-icons": "^5.15.1", "@fortawesome/react-fontawesome": "^0.1.11", "@testing-library/jest-dom": "^4.2.4", "@testing-library/react": "^9.3.2", "@testing-library/user-event": "^7.1.2", "@types/jest": "^24.0.0", "@types/lodash": "^4.14.161", "@types/node": "^12.0.0", "@types/react": "^16.9.0", "@types/react-bootstrap": "^0.32.24", "@types/react-dom": "^16.9.0", "@types/react-responsive": "^8.0.2", "@types/react-router": "^5.1.8", "@types/react-router-dom": "^5.1.5", "@types/react-vertical-timeline-component": "^3.0.0", "axios": "^0.20.0", "bootstrap": "^4.5.2", "faker": "^5.1.0", "lodash": "^4.17.20", "react": "^16.13.1", "react-bootstrap": "^1.3.0", "react-dom": "^16.13.1", "react-flexbox-grid": "^2.1.2", "react-intl": "^5.8.4", "react-responsive": "^8.1.0", "react-router": "^5.2.0", "react-router-dom": "^5.2.0", "react-scripts": "3.4.3", "react-vertical-timeline-component": "^3.3.0", "styled-components": "^5.2.0", "typescript": "^3.8.2"

And functional component look : Captura

stephane-monnot commented 3 years ago

Could you provide a full example please ?

Snaptags commented 3 years ago

That's a React error message and has nothing to do with TypeScript I think. You could try these suggestions: https://stackoverflow.com/questions/62336340/cannot-update-a-component-while-rendering-a-different-component-warning