Check if a URL is an absolute URL with JavaScript
Want to know if a string is an absolute URL? This article will help you out.
30 seconds of code contains a curated collection of code articles covering a wide range of development needs. The collection spans many topics, ranging from simple coding problems to theoretical concepts and development techniques.
Want to know if a string is an absolute URL? This article will help you out.
Can you tell if two URLs are on the same origin? Here's a very simple way to do so.
Ever wondered how React's rendering works? Here's a simple JavaScript function that renders a DOM tree in a specified container.
Learn how to effectively handle the click event outside or inside a component using custom hooks.
If you want to create an element from a string without appending it to the document, you can use a few lines of JavaScript.
Wrapping your mind around React hooks and how they interact with setInterval() can be difficult. Here's a guide to get you started.
Learn how to quickly remove an element from the DOM using JavaScript.
Is useState() too limited for you? Perhaps useReducer() doesn't quite cut it either? Let's explore some advanced state management hooks.
If you're transitioning from class components to functional components, you can replicate the behavior of lifecycle methods using hooks.
Learn how to persist state in React using hooks and localStorage or sessionStorage.
Track the browser's location hash value and search params with this pair of custom hooks.
Learn how to use React hooks to handle window events, media queries, server-side rendering and more.
Learn how to create custom hooks to listen for events in React.
Implement fetch() in a declarative manner using React hooks.
Use the MutationObserver API to watch for changes made to the DOM tree.
Ever wanted to force update a React component? Here's a custom hook that does just that.
Create a portal, allowing rendering of children outside the parent component, with this custom hook.
Observe visibility changes for a given element, using the IntersectionObserver API.
Run a callback at most once when a condition becomes true, using a custom React hook.
Ever wanted to change the title of a page in a React app? You can create a custom hook to do just that.
Use this little trick to create an error dispatcher in React.
Turn requestAnimationFrame() into a custom hook to animate your React components.
Ever wanted to dynamically load an external script in React? Here's a trick to help you out.
Implement setTimeout() in a declarative manner, using a custom hook.