Maintaining href “open in new tab” with an onClick handler in React

前端 未结 5 1670
梦如初夏
梦如初夏 2020-12-13 08:32

I have an onClick (React) handler on a table cell that fires properly, however I want to maintain the \"Open in a new Tab\" feature that having an href on a tag

5条回答
  •  离开以前
    2020-12-13 08:52

    You have two options here, you can make it open in a new window/tab with JS:

     window.open("someLink", "_blank")}>text
    

    But a better option is to use a regular link but style it as a table cell:

    text
    

提交回复
热议问题