question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Component crashes

See original GitHub issue

Hi 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:

bildschirmfoto 2016-01-28 um 15 43 13

Do you have an idea what I am doing wrong?

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Reactions:2
  • Comments:27 (3 by maintainers)

github_iconTop GitHub Comments

31reactions
elreedacommented, Oct 16, 2017

if anyone having the same problem with es5 you need to require default var Select = require('react-select').default; this solved my issue

also if u wanna get rid of the .default you may wanna check babel-plugin-add-module-exports

6reactions
skbaileycommented, May 5, 2016

I’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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found