I am facing issue unexpected token this as ...this is not working as attribute in React.
<button {...this.state.attributes}> Save </button>
this has value in this scope. Thanks in advance.
Regards, Shraddha Agrawal
I am facing issue unexpected token this as ...this is not working as attribute in React.
<button {...this.state.attributes}> Save </button>
this has value in this scope. Thanks in advance.
Regards, Shraddha Agrawal
Might be even a typo ...this and not ..this. See below.
import React, { Component } from 'react';
import logo from './logo.svg';
import './App.css';
class App extends Component {
state = {className:"button", style:{color: 'red'}}
render() {
return (
<div>
<h1>Hello World</h1>
<button {...this.state}>Hello World</button>
</div>
);
}
}
export default App;