-
I've been trying to use react-select in a project I have been working on, however for some reason when I attempt to use it with the most basic configuration provided in the documentation, it crashes my entire application when attempting to render. I have a codepen which mimics the relevant code fragment, also hosted here or code seen below. React is rendering without react-select being used and I can comment it out to render, but no matter what I have tried with react-select I get either error 130 (Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: object.) or error 321 in the case of the codepen linked (Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons: 1. You might have mismatching versions of React and the renderer (such as React DOM) 2. You might be breaking the Rules of Hooks 3. You might have more than one copy of React in the same app See https://reactjs.org/link/invalid-hook-call for tips about how to debug and fix this problem.). Any ideas on what I am missing or what is required to achieve base functionality? Or insight into what kinds of compiler configs will break this? Using webpack with babel (preset-react and preset-env) to build on my project - no clue what codepen uses to compile JSX.
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
My problem ended up being with babel/webpack - other libraries which do not use default exports are unaffected which is what caused only react-select to give me issues. See this StackOverflow thread, specifically the answer from JackiePan1989 (not the accepted answer) to see what I am talking about and what the fix is. If these discussions are ever viewed by someone with permissions on this project, feel free to remove this topic. |
Beta Was this translation helpful? Give feedback.
My problem ended up being with babel/webpack - other libraries which do not use default exports are unaffected which is what caused only react-select to give me issues. See this StackOverflow thread, specifically the answer from JackiePan1989 (not the accepted answer) to see what I am talking about and what the fix is. If these discussions are ever viewed by someone with permissions on this project, feel free to remove this topic.