"Convert to function component" option is disabled in React app

I placed the caret in the code below (first few lines shown) and the "Convert to function component" Refactor option is disabled. Why would it be disabled?

class App extends React.Component {
constructor(props) {
super(props);
config({
editorStylingMode: 'filled'
});
this.dataSource = service.getEmployees();
this.states = service.getStates();
this.dataGrid = React.createRef();
this.notesEditorOptions = { height: 100 };
}
render() {
return (.......
0
2 comments

It's not supported for complex cases (components with lifecycle methods, instance methods, etc.). 

0

Try to delete the constructor from your class then he will show it for you

from :

 

TO : 

Then :

1

Please sign in to leave a comment.