Category "reactjs"

Check if a component is an instance of React.ReactElement<any> in a child map

I have a component that loops through children and wraps them in a div. I am trying to add an exclusion to that, but running into an issue where I can't check i

Sort the array as per the rules of card game using a generic method

cards = ['Jack', 8, 2, 6, 'King', 5, 3, 'Queen', "Jack", "Queen", "King"] <!- Required Output = [2,3,5,6,8,'Jack','Queen','King'] Question: Sort the array as

Add key value pair data

I have a schema in Mongoose that looks like this: const SocketDetailsUserSchema = new mongoose.Schema({ userId: String, socketValue: [{ id: St

Ag grid react warning: State updates from the useState() and useReducer() Hooks don't support the second callback argument

I tried to make an app as simple as possible to make the error easier to understand so I just implemented it in the App.tsx. import { AgGridReact } from "ag-gri

HERE Maps Info bubble not rendering correctly using React

I'm currently developing a React application using HERE Maps Javascript SDK. My Problem: I want to open an info bubble on a marker when I click on it. Instead T

How can I copy text to clipboard with ReactJS?

I am building a React web app that converts a text into an array. I want the user to click on the final output and be able to copy it on the clipboard. I am fol

React Quill - How do I show the differences between two text versions?

I'm currently designing a website with React where the user will work with a text editor. The text editor will already have text in it. The user will make some

change voice in react-speech-kit

I am using useSpeechSynthesis of react-speech-kit to read the text when click button. This is my code: import React, { useState } from 'react'; import { useSpee

React Native Teleport components without loosing state

I am using React Native 0.62 with react-native-video. I need to add a video player with full screen option. The requirements specifically needs custom controls

Babel throwing Support for the experimental syntax 'jsx' isn't currently enabled

I started newly writing unit test cases using Jest and Enzyme for the react application and when try to run test cases using jest like "test": "jest --watch" ra

Webpack conditional build based on configuration values

I'm looking for what ultimately would be a Webpack equivalent to Require.JS's has.js integration. In Require.JS you can compile different code paths based on a

React Console warning --- React.createFactory()

I am facing the below warning in the console whenever my react application renders and every time the code re-renders, Can anyone help me out how to sort out th

React Hooks with Redux & MVVM architecture

I am trying to update my React application to use MVVM as an architecture pattern. I initially built it out with Hooks and Redux. I've come to find out that eve

Use Async/Await with Axios in React.js

Following How to use async/await with axios in react I am trying to make a simple get request to my server using Async/Await in a React.js App. The server l

First Character is not displaying in input field useForms

When I click on Submit, it gives an error "required". But when i type text it doesn't take first character. On entering first character it only removes "require

React Hooks with Redux & MVVM architecture

I am trying to update my React application to use MVVM as an architecture pattern. I initially built it out with Hooks and Redux. I've come to find out that eve

How to set a loading state for react component while sorting and filtering data?

I am trying to implement a table and do filtering and searching of data from the table. Since the searching and sorting takes a while I would like to implement

Adding a key-value pair to an object inside loop using React useState hook

I'm trying to add a key-value pair to an object using useState inside map function. However, the spread operation in setContainer({...container, [data.pk]: data

React not rerendering after mobx observer change

Upon page load, I see "hi2" When I click the button, nothing happens. I tried with setUser as well. I suspect I'm just editing the props themselves and somehow

ReactJS Functional Component vs Component Functions for conditional rendering

Sometimes I want to move my conditional rendering out of render(), and I always have dilemma between these two approaches: class MyComponent extends React.Comp