0

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

JJJ
  • 32,902
  • 20
  • 89
  • 102
Agrawal Shraddha
  • 734
  • 1
  • 5
  • 18

1 Answers1

1

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;
Nithin Thampi
  • 3,579
  • 1
  • 13
  • 13