Press ESC to close

Nick A.
1 Min Read

scrollIntoView() is a JavaScript method that scrolls to element it is called on. Since React is a JavaScript library, we can use it to scroll to element in React. Scroll to element on click Here’s an example where we scroll to element when user clicks…

Nick A.
2 Min Read

We’re going to use react-router to redirect in React. Redirect to another page with useNavigate() hook react-router version 6 provides a useNavigate() hook, which returns a function that navigates to the path provided as a string argument.. Here’s an example: There are multiple ways to…

Nick A.
1 Min Read

We can use the global window interface to get the current URL in React. Plain JavaScript approach We need window.location to access the location object that contains information about the current URL, pathname, domain name, and more. Here’s how to access the current URL value…

Nick A.
2 Min Read

In this article, we will explain onKeyDown and discuss its practical use cases in React. We’ll also look at how to use onKeyDown with <input> elements and listen for specific keys like ‘Enter’. Handle onKeyDown event in React React internally supports onKeyDown event. Simply set…

Nick A.
1 Min Read

Going to the previous page is essential part of browsing experience. In this article, we will explore how to implement a ‘go back’ feature in React. How ‘go back’ feature works Browsers keep track all URLs you visit when browsing a website. This information is…

Nick A.
1 Min Read

React web applications are essentially component trees with branches – a component might render multiple components, which render more components on their own. To build any kind of useful web application, you need to know how to render multiple components in React. Common mistakes Every…

Nick A.
4 Min Read

Nowadays many web applications are overloaded with content. Sometimes you need to highlight certain elements or components by setting scroll position in React. In this article, we’ll show you how to set scroll position when component mounts or when users click a button. Set scroll…