D
D
dmitry-toster2020-05-14 15:34:02
JavaScript
dmitry-toster, 2020-05-14 15:34:02

How to determine device type in react?

You need to execute a certain code if a person accessed the site from a mobile phone.
What solution would you recommend, is it enough to determine the width of the screen through window.innerWidth? If so, what width should I start from?
There is another option to use navigator.userAgent
Just if this can be done using JS in a couple of lines, then I would not want to connect some separate library for this task

Answer the question

In order to leave comments, you need to log in

1 answer(s)
P
Pavel Shvedov, 2020-05-14
@dmitry-toster

see how it's done using js inside some library and drink this piece to yourself

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question