Explore all blogs
Adjacent JSX elements must be wrapped in an enclosing tag
The "Adjacent JSX elements must be wrapped in an enclosing tag" error can be solved by wrapping the multiple elements in a parent div or in a react fragment
Build password strength checker in React
Learn how to build password strength checker/indicator/meter in React to check uppercase, lowercase letters, numbers, special characters, and password length.
Call multiple functions onClick in React
To call multiple functions onClick in React, pass an event handler function into the onClick prop of the element that can call as many other functions as necessary.
Can't Perform a React State Update on an Unmounted Component
Check why the warning “Can't perform a react state update on an unmounted component” occurred and how to solve it using a flag in useEffect hook.
Create a Back button with React Router
To create a back button with React Router use useNavigate() hook. Call navigate function eg. navigate(-1); inside the onClick function of the back button.
Delete an element from an array in PHP
To delete an element from an array in PHP, use built-in functions unset(), array_splice(), or array_diff(). Learn how to remove items using these functions.
Each child in a list should have a unique "key" prop
To solve Warning: Each child in a list should have a unique ”key" prop in React, set the id property as a unique key, or set auto-assigning unique keys.
ERESOLVE unable to resolve dependency tree error when installing npm packages
To solve ERESOLVE unable to resolve dependency tree error when installing npm packages, ignore the peerDependencies by --legacy-peer-deps flag, downgrade the npm version.
Get raw SQL query from Laravel Query Builder
To get raw SQL query from Laravel Query Builder, call toSql() method on the query builder. Use enableQueryLog and getQueryLog methods to get the logged queries.
Get the current route using React Router
To get the current route with React Router, use the useLocation() hook. Use withRouter higher-order component in class component for current URL pathname