Z
Z
zerabora2021-07-20 11:39:24
JavaScript
zerabora, 2021-07-20 11:39:24

Why does Webstorm highlight the spread operator?

handleChangeInput(e){
        const {name, value} = e.target;
        this.setState({obj:{
            ...this.state.obj, [name]:value
        }});


Why does Webstorm highlight the line ...this.state.obj, [name]:valuewith the message Expression statement is not assignment or call?
The code itself is executed, the project also starts without errors, but Webstorm simply underlines all subsequent code in red with the message 'return' outside function definition.

The JavaScript Version is set to JSX Harmony.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Demian Smith, 2021-07-20
@search

Try clicking the Typescript button at the bottom of the screen and finding the Restart item there. Usually helps in such situations.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question