React onClick and preventDefault() link refresh/redirect?

前端 未结 13 766
生来不讨喜
生来不讨喜 2020-11-30 06:04

I\'m rendering a link with react:

render: ->
  `upvote`

Then, above I hav

13条回答
  •  -上瘾入骨i
    2020-11-30 06:56

    I didn't find any of the mentioned options to be correct or work for me when I came to this page. They did give me ideas to test things out and I found that this worked for me.

    dontGoToLink(e) {
      e.preventDefault();
     }
    
    render() {
      return (});
    }
    

提交回复
热议问题