Skip to content
| Marketplace
Sign in
Visual Studio Code>Other>Manta's React ES6 Class MigrationNew to Visual Studio Code? Get it now.
Manta's React ES6 Class Migration

Manta's React ES6 Class Migration

Anantachai Saothong

|
1,362 installs
| (0) | Free
Migrate React.createClass() to ES6 class syntax
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

Basic usage

Simply run Migrate to React class command to convert React stateless components to React class components.

Usage

Additionally, if the file is TypeScript React (*.tsx), this also converts PropTypes to type definitions accordingly.

// Before
class MyComponent extends React.Component {
	static propTypes = {
		className: PropTypes.string,
		children: PropTypes.node.isRequired,
	}

	state = { visible: false }

	render() {
		return <div></div>
	}
}

// After
class MyComponent extends React.Component<{
	className?: string
	children: React.ReactNode
}, { visible: boolean }> {
	constructor(props) {
		super(props)

		this.state = { visible: false }
	}

	render() {
		return <div></div>
	}
}
  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2025 Microsoft