M
M
MaratRomanov2019-06-10 14:32:59
React
MaratRomanov, 2019-06-10 14:32:59

How to make one function for all elements in react?

Good afternoon! Please tell the inexperienced if there is a way to extend one function to all elements in the program? For example: I have an application with several pages, and on each page there is a counter for seconds of user inactivity, which after a certain number of seconds, redirects the user to the main page. How can I (if possible) without writing a function on each element write it in one place and spread it to the whole program as a whole?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Anton Spirin, 2019-06-10
@MaratRomanov

All this can be handled in the root component.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question