Category "reactjs"

Media Queries in Material-UI Using Styled-Components

Material UI has a nice set of built-in media queries: https://material-ui.com/customization/breakpoints/#css-media-queries Material UI also allows us to use S

Media Queries in Material-UI Using Styled-Components

Material UI has a nice set of built-in media queries: https://material-ui.com/customization/breakpoints/#css-media-queries Material UI also allows us to use S

Why the handleChange of Formik is not working when I set multiple functions?

I have problem on formik, the handleChange of formik is not working properly when I add other function inside the onValueChange. Is there any solutions for this

How i can do bubble sort to array with object?

There is a task to make array sorting through Bubble sort. I just can’t understand how exactly it is necessary to implement sorting of such an array, in w

Property 'background' does not exist on type 'unknown'. ReactJS/useHistory()

I'm getting this error Property 'background' does not exist on type 'unknown'.ts(2339), when I try to use this code const location = useLocation(); const backgr

setting "type" to "module" in package.json then not able to read es modules

CONTEXT: I'm trying to start with SSR using react, and I've ran into this problem before the updates, and I'm pretty sure I'm missing something obvious but I'm

Does getStaticProps fetch data every time I get back same page?

I am using routes to get page ex. page/[id].js and show data for that id only. So will it refetch data every time I visit this page? ex. going to the next page

Is it possible to pass props from a React Link to a functional component?

I have a sign up/sign on page, and I want to redirect the user to the last page that they visited on the site before they tried to sign up/sign on (or their pro

TypeError: state.find is not a function

I try to use the find() method but I get cartItems.find is not a function what happens? and how to fix it? import React, {useState} from 'react' function car

Does strict mode work differently with React 18?

Consider the snippets below. With React 18, count gets printed twice to the console on every render but with React 17 it gets printed only once. React 18 Exampl

What is the correct type for React Click Event?

I want to use a type for my event handler instead of using type any, Can anyone help me with this,please? here is the code I'm trying to refactor: const MyComp

dom is not updated after state change via Context API

I am quite new to React and tried to finish a project on FrontendMentor. It's basically a simple OPA of an online store with just one product and the ability to

Exported variable 'store' has or is using name '$CombinedState' from external module error Redux toolkit and redux persist

Hi I'm trying to get redux persist working with redux toolkit (also in typescript) I'm getting the following error: Exported variable 'store' has or is using na

Vertical carousel on scroll react

I want to have a section of the website which is fixed while to slide the carousel on scroll (vertically). Once you are at the last slide the scroll will let yo

How do I console.log a changed state in React?

I'm new to React and am working on someone else's code (thrown in the deep end). There is a simple button has a handleClick() handler. I want to increment a sp

React Error: You cannot render a <Router> inside another <Router>. You should never have more than one in your app

[index.js] import React from "react"; import ReactDOM from "react-dom"; import "./index.css"; import App from "./App"; import reportWebVitals from './reportWebV

Centered maps while pinch to zoom like Uber in react native

How to do it like a Uber app? <View> <MapView onRegionChangeComplete={(e) => { setLocalLocation({ latitude:

FormData with NextJS API

Background I am trying to create a simple CRUD application using NextJS along with react-redux, so what it does is that it saves peoples contacts.So when adding

Unable to mock react-redux hooks after migrating to 8

I have been using the following pattern to mock react-redux hooks in tests that use Enzyme shallow rendering: import * as redux from "react-readux"; ... jest.sp

TypeError: undefined is not an object (evaluating 'state.selectedData.push') - Can't add payload to state using Redux Toolkit

I'm having an issue using Redux Toolkit. I want to push an object to my initial state called selectedData which is an array, this gives me the error "TypeError: