How to access canvas context in React

后端 未结 6 1137
迷失自我
迷失自我 2021-01-11 11:26

I made a color picker with React and Canvas. Currently the components are rendered in React and canvas is done with vanilla javascript. I\'d like to two to mesh more, so I w

6条回答
  •  执笔经年
    2021-01-11 11:34

    It should just be accessing the target of the click

    colorStripClick: function(e) {
      var ctx = e.target.getContext('2d')
    }
    

提交回复
热议问题