Category "reactjs"

How to pass dynamic query name to GraphQL?

Is it possible pass query name to GraphQL using props in React? const allEntries = gql` query allProducts{ '${queryName}' { id name

filter search bar not showing up

I'm trying to create a filtering search bar to sort through a limited set of data pulled from an API. The code compiled successfully, however despite having an

Using makeStyles in material ui with typescript

I'm trying to convert JavaScript template to Typescript. So I have this accordionStyle.ts like below import { primaryColor, grayColor } from "../../material

how to test button that call submit form using jest and react testing library

so I am trying to test that the onSubmit function is getting triggered if the button is clicked - the way im doing this is through testing the internals of the

MaterialUI makeStyles undoes custom css upon refresh in NextJS

I am working on a NextJS site that has some custom styling that is being applied via MaterialUI's makeStyles. It works fine on the first load and then undoes al

Testing onClose callback which is triggered by clicking outside component

The popup has a click away listener which closes it when a click event occurs outside the component. I need to test that the popup has closed. it.only('clicking

Redirect in React Router Dom v6

I need help after the update from React Router Dom to version 6. I have a code snippet for redirects after a user logged in which should work in version 5, but

React: OnChange for drop down return me the entire <select></select> tag

I am working with react and I have a dropdown menu which is generated like that: Select a user : <select defaultValue={'DEFAULT'} onChange={this.handleFilter

Next js, ReactDom.render is no longer supported

I just spun up a new Next JS app with Next 12. I am getting this error on all page loads in the browser: Warning: ReactDOM.render is no longer supported in Rea

dangerouslySetInnerHTML returns [object, object] with any input that contains markup (eg 'a', 'div', 'span', etc)

I've created a custom component that is used simply for display purposes: import React from 'react'; import './CardContainer.css'; import sanitizeHtml from 'san

React apex chart does not render after series array changes [closed]

You will find answer in this post I am new with react I used apexcharts which worked really fine but whenI had to use this chart components, i

How to change localStorage object-variable to false after a certain amount of time

I have an issue with a project where i need to change an object variable to false and save it to local storage. let animalHtml = // Checking if animal is fed or

Mobile Safari skips first seconds of HTML Audio on play()

I have an React Audio Player that uses a useAudio hook to manage the HTML5 audio. It works fine everywhere except Mobile Safari, where the sound begins a few se

Can my symbol be exactly at the middle of mu button?

I have my "+" that is a little bellow the center in my button. How can he be right in the center? Here is my code: Code

"The CSRF session token is missing" when CSRF token is present in request

I am using Flask-WTF to use its CSRF security feature for my API. As the title suggests, the response I get from the API says that the "CSRF session token is mi

React Native android FormData response goes to catch block after .json()

I'm trying to POST data with FormData to get a response, on iOS it works as expected, but on android, it always goes to the catch block, I found out the reason

sort an array with react hooks

I'm doing a simple sort of an array with react hooks, but its not updating state. Can anyone point out what I'm going here? import React, { useState } from "re

How to post data to supabase through next.js

I currently have a simple next.js website where users can look at projects for an organization, and at the bottom of the page, the user can input a new project

What is the difference between Nav.Link vs Link vs NavLink in react router DOM and react bootstrap?

I am confused about these three Links, what are the different ways to use them? Nav.Link Link NavLink i Do they have different use cases?

Load JSON data with useMemo

In the following line: it loads the json data using useMemo import MOCK_DATA from './MOCK_DATA.json' const data = useMemo(() => MOCK_DATA, []) As it's menti