Category "react-hooks"

TypeError: navigation.toggleDrawer is not a function. (In 'navigation.toggleDrawer()', 'navigation.toggleDrawer' is undefined) this error occured

TypeError: navigation.toggleDrawer is not a function. (In 'navigation.toggleDrawer()', 'navigation.toggleDrawer' is undefined) I've called this function as chil

Video can't press play on React

I have a working product that takes a file from API and read as a blob. But pressing the play button on the video does not work. I have tried using tried using

why does this log the old value and not the new value [duplicate]

const [title,setTitle] = useState(""); const titleHandler=e => { setTitle(e.target.value) console.log(title) } Why does this code log

How to test react component based on file reader emitted events

I have a react component called FileReader based off Dropzone react component (https://github.com/react-dropzone/react-dropzone). This file reader calls a callb

Do react hooks work via CDN links in a simple single html file?

What is wrong with the following html & js, I can't use hooks! ... this is the only file in my project (no other files or package managers) <html> <

How can I 'not allow' the user to retrieve same information from the server multiple times in my 'React' Weather-app?

I'm learning React and as a practice I'm building a weather-app. My App Photo Everything is ok. but I want When a User type a City name for example 'London' and

Type 'Dispatch<SetStateAction<any[]>>' is not assignable to type '(values?: string) => void'

I'm very new to typescipt and trying to make a basic pin-input page. Sandbox link for my code . Although it is working, I'm getting this error for onChange func

React console.log showing duplicate results in Dev Tools

Why does React show duplicate console.log? I found that to remove StrictMode from index.js. but there was no such problem before and why did I remove StrictMode

Confused about how to create a ref if there is no forward ref?

There are three options, I don't know which one is the best. //@ts-nocheck import React, { useEffect, useRef } from "react"; export const Child = React.forward

TypeError: getTodosFromUserDevice is not a function Also TypeError: saveTodoToUserDevice is not a function

I have created a todo list and it works fine, but I need to add async storage to store the todo list when the page refreshes, or closes etc. So, I added async s

useinterval in react (polling request)

I've created a simple react (nextjs) app that sends some data to a backend server. While the data are being processed the react app keeps track of the progressi

React State update with button click from another component

Please read the details below of code enter image description here This MegaMenu Component import MenuIcon from '@mui/icons-material/Menu'; import './MegaMenu.c

Trying to run function only if state changes

I want to run the set totals function only if the hour's state has changed. It is running every time the component mounts instead of only if the value changes.

Using function defined in custom hook does not update some value in the state

i recently started using react and i'm trying to write a custom hook used for translating some ui elements. I'm not using a library because it is a larger proje

Functional Component: Write functions inside or outside the component?

I often wrote functional components following a 'Class architecture' where all my function that concern the component are written inside of it like a method in

React showing a blank screen without any error messages (context api used)

I'm building a react Amazon clone, so in order to give the user the ability to add a product into his basket (as the first version of all the future checkout sy

React Native Text style is not working (Icon Badge)

I tried to make a badge icon with red text, but all the styles I applied to the Text didn't work at all IconWithBade.js import React from 'react'; import {Style

How to fix my old react project not working as expected?

I'm new to react and have just added some regex validation to a jsx file in an existing react project (created about 4 months ago) . After building a new bundle

How to toggle boolean state in React and TypeScript?

I am new to React and TypeScript. I want to toggle a boolean state (true/false) with a handler function. I've read other posts about how to do this in ES6 but

useInfiniteQuery but all the data re-rendered every refetch

I'm trying pagination by useInfiniteQuery in React Query, it's refetch data perfectly, but there's a problem that each time new data added, the page re-render a