Questions tagged [react-class-based-component]

230 questions
0
votes
0 answers

passing an element's[Shopping items] to the modal is not working

So, I have been trying to pass the following information my my pop-up modal. I am using react-modal. The indecies of each element or each product is showing correctly. when I console.log(index) for each item the correct index appears. The problem…
0
votes
3 answers

How to change class of a div onclick in React

This is my code: render() { return (
); } When I click the button I want the class of the div to change from .btn.div to .btn divhidden, which…
0
votes
0 answers

Expo React Native: undefined is not an object (evaluating 'this.context.state')

I am with undefined is not an object (evaluating 'this.context.state') error at my React Native application using Expo. context/index.js import React, { Component } from "react"; const MyContext = React.createContext(); class MyProvider extends…
0
votes
1 answer

Not able to set state in class component , Uncaught TypeError: Cannot read properties of undefined (reading 'setState')

while using react classcomponent , I am not able to set the states in the states section,I am trying to set a number and an array from API, I am not able to set both , the number is also showing undefined. There is no error in the api as well, if I…
Tanvesh
  • 127
  • 1
  • 10
0
votes
0 answers

How can we implement filter function in a country map in a superset

I am new in react js and I am learning superset and can add filters in the pie chart, and table but I don't know why I can't add filters on the country if you have any documentation or source code please help me out. I also have good knowledge of…
0
votes
0 answers

i need a package.json file for a project that works with react, graphql and apollo-client

hi i have a problem with a task that required from me that i should do a simple store with 3 pages that uses graphql and apollo client with react but with class components not functional and hooks so if anyone can help me with that because i can't…
0
votes
0 answers

React class component api call in componentDidMount() called twice

New to React here, I'm building a class component with Typescript. I need to fetch data from the server when component displays. componentDidMount() seems to be the right place to do that; but it is always called twice. I found its because of the…
0
votes
2 answers

Is `this.props` possible to be changed in the component itself?

As the title says, is this.props possible to be changed in the component itself whether manually or automatically manual change example this.props.someData = 'some value' I don't know how to change this.props automatically, so I can't write example…
wychoi
  • 37
  • 5
0
votes
1 answer

How can I split a custom data table up into modular components?

i'm looking for some guidance to what would be considered best practice when developing a custom data table. Background: I've been tasked with created a table component that has both static and asynchronous loading for when the user paginates,…
stacker
  • 233
  • 1
  • 5
  • 14
0
votes
1 answer

What is the difference between rcc and rfc in react?

I want a use case example of when react class components are needed for a project over a react functional component and vise versa. I cant seem to understand the difference between the two.
0
votes
0 answers

Save default input value React class

I am trying to pass the state of the name value in my object as a default to one of my input fields but anytime i try to save i get a type error , undefined uuid. you can find the sample of my code below and images of the error. I want the value of…
Lanlokun
  • 1
  • 1
0
votes
0 answers

Displaying data from localStorage in ReactJs

I have a dropdown menu where I can select multiple items. And everytime I choose an item from the dropdown, it is being saved in the localStorage. Upon reloading the browser, I want the selected item to still display in the dropdown selection, since…
0
votes
1 answer

Converting DraftJS class component to Functional component

The following Draftjs code is in class component. The plugins like CreateImage, Focus Plugin, and BlockDndPlugin are being imported from the DraftJS. I would be grateful if somebody can convert the class-based react components into Functional based…
0
votes
1 answer

Redux doesn't work in React Native - class component

this view doesn't work with redux, i need use redux dispatch inside react class component, but i get error "Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the…
0
votes
1 answer

Array map method is not showing list in Class Based Component in React

I have Parent component FoodBox.js and it's child component FoodItems.js. I'm trying make a list of food items stored in the parent comp. and using map() method for it but
    is showing empty. Here is FoodBox.js const FOOD_ITEMS = [ { id: "01",…