Skip to content
Advertisement

Tag: reactjs

‘react-router-dom’ does not contain an export named ‘useHistory’

Im trying to import useHistory from react-router-dom but it keeps giving me the error ‘react-router-dom’ does not contain an export named ‘useHistory’. React-router-dom’s version is 4.3.1 and i’ve tried updating (in case there was an updated version) but every time i do npm install react-router-dom it always just installs 4.3.1 It updated react-router from 4.3.1 to 5.2.0 just fine so

Material-UI Select doesn’t update after onChange

I’ve seen this problem about all around the web but nothing could come short of giving me a valid explanation. I’m using Material-UI Select and the good ol’ setState(…) from React (not hooks though) My component is composed essentially of those lines : And my problem is that my Select component dosen’t update its value after selecting another option. So

Adding a TextInput inside a Modal at React Native

Hi guys I am working on a React Native Project. I’m a newbie to programming/React Native. I don’t know how to put a textinput box in my modal on App.js. want to create an email textinput inside this modal Need some guidance and instructions. Help! https://reactnative.dev/docs/textinput this is the example I am following. I am pasting it inside my app.js

How to listen to external variable changes in React

Hope you’re doing well 🙂 I’ve an “auth.js” file, with an aysnc function to get the userId and then store it in session storage. Here it is: Then I access this variable in all components that need it, in order to make other requests. Example in App.js: The problem is that, in the first render, the userId comes null (obviously)

Why won’t setMatrix([…matrix, [[x][y]]]) work?

I want to add the coordinates x and y (from the loop) to the state (matrix) like you can see in my example but it won’t work. Can someone help me? Answer The problem is in expression [x][y] which evaluates to undefined. [x] defines an array containing one element x [x][y] tries to index the [x] array, taking y-th element.

Forwarding props from parent to child component

I have 2 components list of posts and when clicking on link on post card i’m entering into post. I can’t access props.postDetails in child component. When I console log the props, I have {history: {…}, location: {…}, match: {…}, staticContext: undefined} only this without props.postDetails. Can somebody help? Code for parent component is: Code for child component: Answer Issue

Advertisement