Skip to content

VSCode thinks there are 2 definitions of a React Component #51459

@mdo5004

Description

@mdo5004

VSCode thinks there are 2 definitions of a React Component

This issue was brought up recently but without sufficient info. Here is a minimal reproduction example:

  • VSCode Version: 1.24.0
  • OS Version: MacOS High Sierra 10.13.4 (17E202)

Steps to Reproduce:

  1. Create a React app
$ create-react-app my-bug-example
$ code my-bug-example
  1. Change src/App.js to
import React, { Component } from 'react';

class App extends Component {
  render() {
    return (
      <div className="App">
      <MyComponent />
      </div>
    );
  }
}

export default App;

class MyComponent extends Component {
  render(){
    return <MySingleComponent text="Instance 1" />
  }
}

class MySingleComponent extends Component {
  render(){
    return <p>{text}</p>
  }
}

  1. CMD + hover on <MySingleComponent text="Instance 1" />

screen shot 2018-06-08 at 10 33 09 am

  1. CMD + click on <MySingleComponent text="Instance 1" />

screen shot 2018-06-08 at 10 33 26 am

Does this issue occur when all extensions are disabled?: Yes

Metadata

Metadata

Assignees

Labels

bugIssue identified by VS Code Team member as probable bugupstreamIssue identified as 'upstream' component related (exists outside of VS Code)verifiedVerification succeeded

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions