Category: react js

  • mix’ is not recognized as an internal or external command

    Likely you need to install the latest version of Laravel Mix.

    npm install laravel-mix@latest --save-dev
    

    or

    It will happen when your cache holds previous files.Clear the cache and install the npm again

    npm cache clean --force
    

    then

    npm install
    
    npm fix audit
    
    npm run development
    
  • Fix export ‘useHistory’ (imported as ‘useHistory’) was not found in ‘react-router-dom’ error in react js

    In react-router-dom v6 useHistory() is replaced by useNavigate()

    import { useNavigate } from 'react-router-dom';
    const navigate = useNavigate();
    navigate('/home');

    (possible exports: BrowserRouter, HashRouter, Link, MemoryRouter, NavLink, Navigate, NavigationType, Outlet, Route, Router, Routes, UNSAFE_LocationContext, UNSAFE_NavigationContext, UNSAFE_RouteContext, createPath, createRoutesFromChildren, createSearchParams, generatePath, matchPath, matchRoutes, parsePath, renderMatches,
    resolvePath, unstable_HistoryRouter, useHref, useInRouterContext, useLinkClickHandler, useLocation, useMatch, useNavigate, useNavigationType, useOutlet, useOutletContext, useParams, useResolvedPath, useRoutes, useSearchParams)