Category "reactjs"

IntersectionObserver with React & Hooks

I'm trying to track element visibility with React/Hooks and the Intersection Observer API. However, I can't figure out how to set up observation with "useEffect

Is there a more functional way to merge and foreach/sort two arrays in TypeScript, React?

I'm learning React and TypeScript. For sake of practise, I've tried to create a calculator design by merging two arrays to map a single array onto the grid (dis

How can I test google.maps.Geocoder?

Hi! I'm attempting to write a "simple" test to check for a react class component state change. Specifically, I'm testing if the lat(latitude) and lng(longitu

how to solve Matched leaf route at location "/project" does not have an element error?

I'm learning react routing but when I try to use BrowserRouter I'm getting the following error: Matched leaf route at location "/project" does not have an elem

Argument of type 'AsyncThunkAction<any, void, {}>' is not assignable to parameter of type 'AnyAction'

store.ts export const store = configureStore({ reducer: { auth: authReducer }, middleware: [], }); export type AppDispatch = typeof store.d

How can I stop a react-query useQuery running on a refetchInterval when a condition is met?

I have a requirement to keep fetching data until a condition is met I can set up the fetch on an interval with the snippet below but I can't figure out how to s

How to properly use ref with indiana drag scroll to set initial scroll position

I've been trying to implement the initial scroll from https://codesandbox.io/s/react-indiana-drag-scroll-initial-scroll-getelement-99o6q?file=/index.js:317-382

Backend Api error (502 bad gateway) from React Cilent to Express Server during deployment

I am trying to deploy my app on digital ocean (react-express app). During deployment, I used to make my requests to the following endpoint "http://localhost:800

How would I add a auto scroll feature to this code?

https://codepen.io/hexagoncircle/pen/jgGxKR?editors=0110 I was looking around for cool code to play around with and found this. I tried the classic google the

How to add custom font in react-pdf/pdf

Can anyone say how to add custom font with @react-pdf/pdfkit in react.js? I tried to use doc.registerFont(path, font_family) But its showing an error like Unhan

React - get data with axios

In my react app that is based on class components, My response API got from open weather fixes after several lags. this is my state class Weather extends Compon

How to change default sorting icon on table header column on React Material-Table?

Can I change the default sorting icon on React Material-Table table header column ? ex. I want to change asc sorting icon to ArrowDownward and desc sorting icon

How to change default sorting icon on table header column on React Material-Table?

Can I change the default sorting icon on React Material-Table table header column ? ex. I want to change asc sorting icon to ArrowDownward and desc sorting icon

Material UI / React - close accordion onSubmit

I have a form within an accordion - what I want to do is when the form is submitted collapse the accordion. <Accordion elevation={3}> <AccordionSummary

Material UI / React - close accordion onSubmit

I have a form within an accordion - what I want to do is when the form is submitted collapse the accordion. <Accordion elevation={3}> <AccordionSummary

Validating array of different object shapes in yup

I am using formik for form validation and came across some problems in array validation. here is my form structure { flow: [ { text: "hello" }, { input:

Redirects doesn't work on netlify with nextjs

I simply followed the doc by adding this to my next.config.js module.exports = { reactStrictMode: true, async redirects() { return [ { so

Jest messageParent can only be used inside a worker

Is there a way to get a proper error message? when i do $npm test and I intentionally break my code(cough cough remove a line of code) I get this message src/re

React: add HTML from generic file path at server-side build time

The use case I'm trying to fulfill: Admin adds SVG along with new content in CMS, specifying in the CMS which svg goes with which content CMS commits change to

How to reach the data from Redux devtool?

I want to reach the data of 'audience' under an endpoint where it shows in Redux dev tool of Google Chrome. Is it possible to reach it like we reach the localSt