Category "reactjs"

How can I use a function from another file in react?

I would like to create a file (function.js) for a function that does this: let i = 0; if (this === that) { i = 0; } else { i = 1; }

material community icons, setting the size causes android to crash?

I have no idea why setting the size like I am on line 38 is causing the android app to crash. If you take the size away, it works perfectly fine. I have all of

Failed at the [email protected] start script

I am currently facing a deployment issue, can anyone help me with it? Repo: https://github.com/PradhumnaPancholi/Mail-it Error Msg: npm ERR! Failed at the serve

Using Truffle-React + IPFS dependency issue

Hooking up IPFS to my Truffle React project is causing me issues. I'm getting a dependency error (I'm thinking that's what's going on) that I can't find anythi

How to play an mp3 once onClick in react?

i have a that i want to play a very small mp3 once that is in my public folder in my react app, there are so many different solutions to playing audio but none

Could not find a declaration file for module 'react/jsx-runtime'

I am using material-ui in react with typescript template. All of my code is working fine but I am getting this error on multiple lines (not an error warning but

Invalid configuration object. Webpack has been initialised using a configuration object that does not match the API schema

I have this simple helloworld react app created from an online course, however I get this error: Invalid configuration object. Webpack has been initialised

Firestore to query by an array's field value

I'm trying to run a simple query, where I search for a document that contains a value inside an object array. For instance, look at my database structure: I wa

Material UI Button - Align Ellipsis Label with Start Icon

I'm trying to set a start icon on a button and also the text label could be very long to use ellipsis at the end. I can't figure it out a way to align the start

Failed prop type: Invalid prop `errors` of type `string` supplied to `CreateProfile`, expected `object`

I am trying to create a profile for a user on login, after submitting the form I am getting the error as invalid props errors. As both my client and serv

How to update react state without re-rendering component?

I am building a gallery app where I need to create multiple HTTP requests to pull gallery entries(images & videos). As gallery will be auto scrolling entr

event.target.value as a number?

const [data, Setdata] = useState<number[] >([]); const [inputData, SetinputData] = useState<number>(0); const [canAdd, SetcanAdd] = useState<boo

useRef TypeScript - not assignable to type LegacyRef<HTMLDivElement>

I am trying to use useRef with TypeScript but am having some trouble. With my RefObject (I assume) I need to access current. (ie node.current) I have tried the

peer.on('calll') is never being called

Peer js is not working I am just creating peerjs video streaming application in NodeJs and ReactJs The below code is working fine, i am able to create new peer

In React with Formik how can I build a search bar that will detect input value to render the buttons?

New to Formik and React I've built a search component that I'm having issues with the passing of the input value and rendering the buttons based on input length

How to use the default value attribute of a select tag

Now im working on a small task with a select tag like this <select name="selectmedgroup" id="selectmedgroup" value

Using ES6 Map with React and/or Redux

I am looking at using the ES6 Map object to do my hashing for me, instead of creating a custom hashing function. However, it seems to me that it doesn't have mu

What are assertions in JEST?

It's documentation says that while dealing with async code, expect.assertions(x) should be written. What exactly do assertions refer to? Is it a term of plain J

React - Jest - Enzyme: How to mock ref properties

I'm writing test for a component with ref. I'd like to mock the ref element and change some properties but have no idea how to. Any suggestions? // MyComp.jsx

Why remove QA IDs from the code base in production

In a React application that we are developing we use QA IDs for Selenium tests. Is it bad practice to leave them in the code base in production (live)? If so,