Latest Posts in React

Browse latst posts in React Category

Published 15 Feb, 2022
How To Check Form Is Dirty Before Leaving Page/Route In React Router v6?

You can check and make sure that a form is dirty or not before leaving a page using this technique.

Published 17 Jun, 2022
React.Js - Typescript how to pass an array of Objects as props?

You can simply return this in the User component: return ( ) Then the UsersList component will becom...

Published 18 May, 2022
How to use useEffect on button Click?

You have to set your fetchPosts outside of the useEffect. Then, you can use a new state search to tr...

Published 10 Jun, 2022
How to mock interceptors when using jest.mock('axios')?

This was enough in the end, plain and simple jest.fn() jest.mock('axios', () => { return { intercept...

Published 04 Jun, 2022
How to mock/spy useState hook in jest?

You need to use React.useState instead of the single import useState. I think is about how the code...

Published 15 Feb, 2022
How to apply blur effect to background when modal is opened in React?

How to apply blur effect to background when modal is opened in React?

Published 18 Jun, 2022
How to detect window size in Next.js SSR using react hook?

You can avoid calling your detection function in ssr by adding this code: // make sure your function...

Published 12 May, 2022
NEXT JS - How to remove Query Params

According to the History, you can using history.replaceState to implement this. window.history.repla...

Published 02 Jun, 2022
How to detect the device on React SSR App with Next.js?

LATEST UPDATE: So if you don't mind doing it client side you can use the dynamic importing as sugges...

Published 06 Jun, 2022
How to convert image source into a JavaScript File object

Convert your image src https://cdn.shopify.com/s/files/1/0234/8017/2591/products/young-man-in-bright...

Published 31 May, 2022
How to delete web application cookies in react js

You can access cookies through document.cookie. In order to remove a cookie, you can set the expirat...

Published 21 May, 2022
How to implement remember me functionality in react js

Finally resolved the problem, I used cookies for when the remember me is unticked and local storage...

Published 29 May, 2022
How to create a d3 force layout graph using React

Since D3 and React haven't decreased in popularity the last three years, I figured a more concrete a...

Published 08 Jun, 2022
How to hide navbar in login page in react router

You could structure your Routes differently so that the Login component doesn't have the Header Like...

Published 06 Jun, 2022
How to test useRef with Jest and react-testing-library?

You can move your useEffect out of your component and pass a ref as a parameter to it. Something lik...

Published 25 Jun, 2022
How to set proxy when using axios to send requests?

I got it working correctly. What I did was: 1) change axios.post('/api/users', body, config); to axi...

Published 23 Feb, 2022
How to create sticky headers on scroll with react

How to create sticky headers on scroll with react

Published 22 Feb, 2022
How To Cache Images in React?

How To Cache Images in React?

Published 14 Jun, 2022
How to test different screen widths using Jest

Jest uses jsdom to simulate a browser. jsdom defines the window width and height to be 1024 x 768 Y...

Published 18 May, 2022
How to handle a post request in next.js?

To get POST requests working in Next.js API routes, you likely want to do 3 things. Limit the method...