Questions tagged [react-class-based-component]

230 questions
0
votes
1 answer

How do I convert this ReactJS class based component to function based component?

I am trying to repeat a inputbox when a user submit a data on a textbox. The solution I have able to create following through several sources is as: a simple input box, inputbox.js import React from 'react'; const InputBox = () => { return( …
0
votes
1 answer

Why I am getting: No `render` method found on the returned component instance: you may have forgotten to define `render`

This is the error I got: No `render` method found on the returned component instance: you may have forgotten to define `render`. in Component (at withScreenDimensionHOC.js:11) The error caused when I wrapped the HOC to class component export…
0
votes
2 answers

function keyword in class based component and inChange event

Can anyone please help me understand if there's any issue with the below code snippet: import React, { Component } from "react"; class AddContactForm extends Component { constructor() { super(); this.state = { …
Amit Gupta
  • 107
  • 2
  • 10
0
votes
1 answer

How can I convert class component to functional component?

I have a class based component, and I want to convert to the functional based component, my code is below: import { enableRipple } from '@syncfusion/ej2-base'; import { DropDownButtonComponent } from '@syncfusion/ej2-react-splitbuttons'; import * as…
user10991969
0
votes
0 answers

Converting class component to functional component Props in Functional component not passing properly and Query not being received

Hey I am trying to covert a class component into a functional component and for some reason the props I'm passing into the form component are being passed as object values. The original class component works fine but I am not sure what is causing…
0
votes
1 answer

Converting class-based component into functional component input query not being read

I am trying to convert this class based component into a function component. For some reason the Query (setQ) is not being read by the handleFormSubmit function. When I make the param in the setQ an object the value of the input form becomes…
0
votes
2 answers

Converting Class Component to Function Component

I'm new to React and I'm trying to incorporate viewSwitching from https://devexpress.github.io/devextreme-reactive/react/scheduler/docs/guides/view-switching/ into my project. The issue I'm facing is that this view has class components and I've…
0
votes
2 answers

react (class based) : How can I update JSON object in parent component using setState after the object being passed in function from child to parent?

I've JSON data at "Data.js" and in "App.js" it is initialized in state. In "updateList" method of "App.js" I am getting "dataa" - from "insertIt" of "Form.js" and I need to "setstate" too in "updateList" of "App.js". please help me correct my…
0
votes
2 answers

Toggle only one element of map array with react and typescript

i'm mapping a reviews API's array and i want to show only the clicked review when i click on "read more" but at the moment is expanding all the reviews of my array, i'm using typescript and it's all new to me so i don't know how to move, how should…
user15969584
0
votes
1 answer

how to avoid re-rendering when passing the object into value of context.provider using React context

In class component when we want to pass the object to the value of context provider using react context, we have a way to avoid re-rendering issue. Below are the codes class App extends React.Component { constructor(props) { super(props); …
0
votes
0 answers

React pass a function to another component

I want to use a function checkboxes from the class Apps that looks like this: checkboxes(selecter, id) { if (document.getElementById(id).checked === true) { this.doboolAPICall(selecter); } } in another component that's named…
0
votes
1 answer

how to return a variable in an object jsx

See line in question with >>>. The code is currently like this: tableData() { const filteredEvents = this.props.graphData.events.filter((event) => moment(event.eventDate).isBetween(this.startMoment, this.endMoment) ); const…
nm12
  • 81
  • 7
0
votes
1 answer

How can I change this functional component into a class based component in react native?

I am trying to change this functional-based component into a class-based component so that I can setState with value getting from slider left and right cursors. import React, { useState } from "react"; import { StyleSheet, View, Text } from…
0
votes
2 answers

Using useEffect (or the equivalent) for class component (making a loading screen)

I am fairly new to React. I have currently made a loading screen in React with useEffect, but I'm not sure how to make it with class Components. This is my functional component which works. const [sourceLoading, setSourceLoading] =…
0
votes
1 answer

How do you implement bindActionCreators in class component with out using "connect"

I'm trying to find a way to convert this code to class based component: import React, {useEffect} from 'react' import { useSelector, useDispatch } from 'react-redux' import { bindActionCreators } from 'redux' import { addComments } from…
Melly
  • 675
  • 8
  • 24