2

I am trying to disable mouse events in react. I tried pointer-events: none and document.body.style.cursor = 'none'. both didn't work. I tried it on whole body or on App. Can't get it to work. I basically wanted to hide mouse pointer for sometime and put it back.

ravibagul91
  • 20,072
  • 5
  • 36
  • 59
user3900196
  • 457
  • 2
  • 6
  • 18

1 Answers1

2

Ok you need to wrapper that object

class Hello extends React.Component {
  render() {
    return <div style={{cursor: 'none'}}>
             <button style={{ pointerEvents: 'none'}}>
                Hello {this.props.name}
             </button>
           </div>;
  }
}

ReactDOM.render(
  <Hello name="World"/>,
  document.body
);

By base of CSS can't combine pointerEvents: 'none',cursor: 'none' directly.

You need to wrapper that item and separate style like here

DEMO: https://jsfiddle.net/limitbrk/g9w7es5p/

I'm Limit
  • 889
  • 5
  • 18