React - How to open PDF file as a href target blank

前端 未结 6 604
感情败类
感情败类 2021-01-04 00:19

This mundane task fairly simple on static views, isn\'t complying with React.

Can someone advise me how to open a pdf file as a href on a new tab?

Here\'s my

6条回答
  •  攒了一身酷
    2021-01-04 00:58

    I placed the following in the header of the component I needed it in. The document was stored in Documents folder under src.

    import Pdf from '../Documents/doc.pdf';
    

    And then used the imported document in the tag using href.

    Resume
    

    Worked for me!

提交回复
热议问题