Explore all blogs
Get the Mouse Position (coordinates) in React
To get the Mouse position (coordinates) in React, use mousemove event and access event properties clientX and clientY for coordinates of the cursor on window.
How to check internet connection(online or offline) in React
To check the internet connection(online or offline) in React, use the navigator.onLine property which returns Boolean whether the browser is online or offline.
How to create a scroll to top button in React
Learn how to create a scroll to top button in React. In this tutorial, we created a customizable ScrollToTop from scratch using React hooks and window object.
How to create multiple where clause query using Laravel eloquent
Multiple where clauses can create by chaining the where() method. You can use orWhere, whereNot, etc to create complex where queries in Laravel Eloquent.
How to get window width and height in React
To get the window width and height in React, use the window object’s innerWidth and innerHeight properties and add an event listener for the resize event.
How to pass event and parameter onClick in React
We set the inline arrow function (event) => clickHandler(event, "Hello World!") as props to the onClick event handler in the button. The arrow function takes the event as an argument and calls the clickHandler function.
How to use Profiler API in React to measure render performance
To use Profiler API in React to measure render performance, import the Profiler component from React, wrap the component, and define onRender callback function.
Laravel Cron Job Task Scheduling Tutorial
To set up cron job task scheduling in Laravel, create a custom artisan command, schedule to run the task in kernel.php, and add task scheduler into crontab.
Programmatically update query params in React Router
To programmatically update query params in React Router, use the useSearchParams hook from ‘react-router-dom’ that return searchParams and setSearchParams.
React Hook is Called Conditionally
Error: "React Hook is called conditionally. React Hooks must be called in the exact same order in every component render" occurs when hooks are invoked conditionally or after a return of a value.
Reset to the initial state in React
To reset to the initial state in React, store the initial state in a variable and when reset is required, pass the initial state variable to setState() function.
The style prop expects a mapping from style properties to values, not a string
"The style prop expects a mapping from style properties to values, not a string" React error occurs when we pass a CSS string to the style attribute.