Category: React

  • Why VS Code contains emphasized items but no error?

    Why VS Code contains emphasized items but no error? When working with JavaScript in Visual Studio Code (VS Code), you may come across situations where certain items are emphasized or highlighted, but no error is displayed. This can be confusing, especially for developers who are new to the editor. In this blog post, we will…

  • material-ui Drawer – findDOMNode is deprecated in StrictMode

    material-ui Drawer – findDOMNode is deprecated in StrictMode If you are using the material-ui library in your React application and have recently upgraded to React 16.3 or above, you might have encountered a warning message stating that findDOMNode is deprecated in StrictMode. This warning is related to the use of findDOMNode in the Drawer component…

  • React-router Urls Don’t Work When Refreshing or Writing Manually

    React-router URLs don’t work when refreshing or writing manually If you have been working with React and React-router, you might have encountered a common issue where the URLs don’t work as expected when refreshing the page or manually typing them in the browser. This issue occurs because React-router handles routing on the client-side, which means…

  • How to Fix Missing Dependency Warning When Using Useeffect React Hook

    When using the useEffect React Hook, you may come across a warning in the console that says “React Hook useEffect has a missing dependency”. This warning is triggered when the dependency array provided as the second argument to useEffect is missing a value that is used within the effect. It is important to address this…

  • React.js Inline Style Best Practices

    React.js Inline Style Best Practices React.js has gained immense popularity among developers due to its component-based architecture and efficient rendering. One of the key features of React.js is the ability to apply inline styles to components. Inline styles offer a convenient way to style components directly within the JavaScript code, eliminating the need for separate…

  • How to Push to History in React Router V4?

    React Router is a popular library for handling routing in React applications. With the release of React Router version 4, there have been some changes in how to push to history. In this blog post, we will explore different solutions to the problem of pushing to history in React Router v4. Solution 1: Using the…

  • How to Add Fonts to Create-react-app Based Projects?

    How to Add Fonts to Create-React-App Based Projects? If you are working on a Create-React-App based project and want to add custom fonts to enhance the typography of your application, you’ve come to the right place. In this blog post, we will explore two different methods to add fonts to your Create-React-App projects. Method 1:…

  • Invalid Host Header When Ngrok Tries to Connect to React Dev Server

    Have you ever encountered the “Invalid Host Header” error when using ngrok to connect to your React development server? This error can be frustrating and prevent you from accessing your application through ngrok. But don’t worry, in this blog post, we will explore different solutions to resolve this issue. Solution 1: Specify the Host Header…

  • The create-react-app imports restriction outside of src directory

    The create-react-app imports restriction outside of src directory If you have been working with create-react-app, you may have encountered the restriction on importing files or modules from outside the src directory. This limitation is in place to enforce a clear separation between the application code and other files, such as configuration files or server-side code.…

  • React proptype array with shape

    React PropTypes Array with Shape When working with React, it is common to pass props from a parent component to a child component. PropTypes are a way to validate these props, ensuring that the correct data types are being passed. In some cases, you may need to pass an array of objects as a prop…