I’m trying to use Codesandbox in React project, but I’m stuck with error: Could not find/install babel plugin ‘proposal-decorators’: Cannot find plugin ‘proposal-decorators’ or ‘babel-plugin-proposal-decorators’. Error happens when I adding firebase utility in t…
Tag: reactjs
React – Cannot read properties of null (“reading useState”) error
I’m trying to do some form validation in react, and I’m getting this error “Cannot read properties of null (reading “useState”). I’ve done a bit of research on SO, and others have resolved this by including an onChange which setups the useState, but this hasn’t resolv…
Prettier adding semicolon when semi: false
I have a react component with this jsx When I save the file prettier automatically adds a semicolon infront of <Post … />. This is causing the component to fail to render. I have the semi option set to false. Answer This is happening because currently your map function is not returning anything &l…
how to use setTimeout on a react component
This question might be simple to most web developers but I am pretty new and cannot figure out the way to put a settimeout function on what I would like to show on a page. below is the example of the code I would like to add a timeout for. and here is my app.jsx which then will be exported
location props in gatsby is not defined
I am trying to use location props in my gastby page : I am passing props in my Link in pages/index.js: pages/date/[dateId]/index.js: eventually I get an error Parsing error: Identifier ‘location’ has already been declareded : Answer You should have the location variable already defined, it is like…
How to change Fluent UI icon color on mouse hover?
i am using Fluent UI in my project. I initializing my button with this simple code in javascript: and i can override default color to asked one. My question is, how to set mouse hover color over button? https://learn.microsoft.com/en-us/javascript/api/react/iiconprops?view=office-ui-fabric-react-latest#@fluen…
React, setInterval not working properly, h1 element not being updated correctly
I want to create a simple React app that upadates a h1 element every second with setInterval function. I have an array with strings and every second I want randomly pick a string from that array and uses that string inside h1. But my code doesn’t work properly. h1 is not being updated every second but e…
Build failed to compile – Attempted import error
My attempt to build for production fails every time because of this error: Attempted import error: ‘decrypt’ is not exported from ‘../../../../util/security’ (imported as ‘decrypt’). This error only appears when I try to build for production (npm run build). Here is the way…
React Native – Variable does not update correctly when retrieving data from AsyncStorage
I’m trying to store and get data that I fetch from an API. The user is supposed to get a token on the login screen, and the token will be shown in an Alert dialog on home screen when the user press a button. But the token is not shown in the Alert dialog. the token is shown after I
Share QR React Native
I’m new in react/react native. I’m trying to share a QR Code as image. Generate QR works, but I want to share it as an image (whatsapp, bluetooth, etc). I tried “get base64 string encode of the qrcode” from official documentation, but I just don’t get it What I tried to do (all m…