Category "reactjs"

How can I use redux and graphql with apollo client in the same react app?

I'm working on a project, and I'm using apollo/client, graphql in react, and for the global state management, I have to use redux. I'm quite sure I'll have to h

react-suneditor css not loading on production

I set up react-suneditor just as it said in the docs, using dynamic loading since I'm using Next.js. import React from 'react'; import dynamic from "next/dynami

How to make non-sibling elements have the same height in React

Is it possible to make non-sibling elements to have the same height (the height of the tallest one) in React? That obviously cannot be done with CSS. That wou

How to import and play all audio files from a directory in React?

I am trying to play each audio file located inside a directory using React. I can play one file as follows but I do not want to import each file since there 70

Adding styling to rails react component wrapping div

I'm using react_component in my Rails project. This inserts a wrapping div for the react.js component, e.g. <div data-react-class="ButtonSwitchToTab" data-r

Get Authenticated user in a React JS app which is behind Google IAP

I have a React JS app which is behind the Google IAP. I need to get the IAP authenticated user email and use it in the app. How can I do that? IAP adds X-Goog-A

Cannot read properties of undefined (reading 'bind') useQuery

I have this code right here import React from "react"; import { useQuery } from "@apollo/react-hooks"; import gql from "graphql-tag"; const FETCH_POSTS_QUERY

How to import SVG into Next.js component?

I am trying to import an SVG image from file into a Next.js component. In the assets folder I have google.svg (icon): <svg className="svgIcon-use" width="25"

React-leaflet map shows scattered blocks of maps

I was trying to show a sample map on my react website. I have installed the leaflet package and also the react-leaflet package then set everything up as the rea

How to make Visual Studio Code show errors when using missing SCSS styles in a React app?

In my React app I import styles from a SCSS file like this: import styles from './index.module.scss'; To use a particular SCSS style I set up a className on a

How can I write a jest test if in a component uses a function that is passed through the context?

It is necessary to test the component SlotItem. In it function is transferred through a context this.context.i18n.t("free") My component: import React from 'r

Does useCallback make sense for not memoized components?

During reconciliation react compares trees and gets differences. Does it make sense to decrease those differences by using memoization hooks when components are

How can I solve react dom warning message?

How to solve this warning message? react-dom.development.js:86 Warning: Cannot update a component (BrowserRouter) while rendering a different component (SocialL

How to plot x,y coordinates of item on a image in html

I need to place/plot a pin(Small image to point the parts of person) on a image(For example: A image of person). I am getting x,y,height,width values from ser

How to show a dropdown list on a contentEditable span/div item when user tries to change the text of span

I have a contentEditable span element defined as: <span contentEditable={this.props.enableEditColumn} onKeyPress={this.checkInput.bind(this,columnDef)}>

Trigger onblur event on click of enter keypress in React js

I have an input text field . When a user inputs any text and clicks enter button I need to activate the blur event to remove the focus and also to validate the

React router, redux, electron: router isn't rendering

I'm trying to get react-router to work in an electron app. I'm using a boilerplate and stripped away some of the stuff I don't want but that should provide a pr

Secure Node API for React Front End

I’m building a React application with a Node backend. In the backend I have an API that just talks to a database and I can deploy the API and the React ap

Unable to save to array React state from the response from the server

I'm trying to save my response.data to my array state of React, but it never stores the correct array. But when I do a temporary array it works. const [allstude

Apollo `useMutation()` stuck loading inside Next.js component

The following form component in Next.js submits without errors but never completes the mutation. Instead it get's stuck in the loading state. import React, { us