Component crashes
See original GitHub issueHi and thanks for react-select!
I want to use react-select in apache/couchdb-fauxton
The component renders if I disable it:
<Select
ref="stateSelect"
disabled={true}
options={options} />
However when I enable it, it crashes with:
Warning: React.createElement: type should not be null, undefined, boolean, or number. It should be a string (for DOM elements) or a ReactClass (for composite components). Check the render method of `Select`.
Uncaught Invariant Violation: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: undefined. Check the render method of `Select`.
I already tried a lot of things to fix it, but I am quite puzzled now. Here is the full code which crashes:
var STATES = [
{ value: 'australian-capital-territory', label: 'Australian Capital Territory', className: 'State-ACT' },
{ value: 'new-south-wales', label: 'New South Wales', className: 'State-NSW' },
{ value: 'victoria', label: 'Victoria', className: 'State-Vic' },
{ value: 'queensland', label: 'Queensland', className: 'State-Qld' },
{ value: 'western-australia', label: 'Western Australia', className: 'State-WA' },
{ value: 'south-australia', label: 'South Australia', className: 'State-SA' },
{ value: 'tasmania', label: 'Tasmania', className: 'State-Tas' },
{ value: 'northern-territory', label: 'Northern Territory', className: 'State-NT' },
];
var JumpToDatabaseWidget = React.createClass({
render: function () {
var options = STATES;
return (
<div>
<Select
ref="stateSelect"
disabled={false}
options={options} />
</div>
);
}
});
Here is a screenshot with the stacktraces:
Do you have an idea what I am doing wrong?
Issue Analytics
- State:
- Created 8 years ago
- Reactions:2
- Comments:27 (3 by maintainers)
Top Results From Across the Web
React App Crashes When a certain Component Rendered
I got the component which cause the insertBefore error inside span tag. It solved the issue.
Read more >The Windows Imaging Component crashes on a computer that ...
Fixes a problem in which the Windows Imaging Component crashes on a computer that is running Windows 8 or Windows Server 2012.
Read more >How to troubleshoot Siebel component crashes on Microsoft ...
This document provides the steps to troubleshoot Siebel component crashes on Microsoft Windows. Troubleshooting Steps. Sign In. To view full ...
Read more >Error Boundaries - React
Error boundaries are React components that catch JavaScript errors anywhere ... If some component in one of these UI areas crashes, the rest...
Read more >VS Crashes When I Choose Com Components
I have a similar problem. When you select the COM component tab, the Visual Studio program is restarted. Tried to reinstall the program...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
if anyone having the same problem with es5 you need to require default
var Select = require('react-select').default;
this solved my issuealso if u wanna get rid of the
.default
you may wanna check babel-plugin-add-module-exportsI’m also getting the same error as @mharrisweb
It seems that instead of using
<Select.Async loadOptions={} />
the approach that works is<Select asyncOptions={} />
but that doesn’t seem to be in the documented options here although there are references to it.