E
E
EvgenJunior2021-08-22 10:16:57
React
EvgenJunior, 2021-08-22 10:16:57

How to create a separate page and print it out?

React + Typescript project. When you click on the button, you need to create a separate html (progress report layout, mainly tags <p>, <table>) page, write a script to it that will make a request to the server, insert data into the html page and this page can be printed / saved. The question is:
1. How to make the parameter from the React component to the html page be passed when the button is clicked (when you work in React, this is the transfer of props, I know, but I don’t know how to pass it to a separate page)?
2. How to launch a new html page in a new tab? - window.open() method doesn't work correctly in React. Calling the window.open('page.html') method does not navigate to the correct page.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Valery, 2021-08-24
@vmakhnyuk

https://www.npmjs.com/package/react-to-print

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question