I have a form where user can generate new inputs to the form he wants to submit, however i am stuck on handling the values of the new generated inputs as i need to store them in the state. My code const [supply_detail_data,setSupply_detail_data]=Re...
Let's say i have this component, export default function Xyz(props) { ... } If i use object destructing, export default function Xyz({x, y, z}) { ... } I want know that if i use the destructing method for every method for every functio...
I'm new to React, I'm trying to learn React function Component state. I was wondering why we need to do onClick={() => setCount(count + 1)} instead of onClick={setCount(count + 1)} import React, {useState} from 'react'; function...
import { useEffect } from "react"; export const Routes = () => { useEffect(() => { console.log("red") }, []); const a = [{ name: "sathish" }]; const b = [{ name: "pandi" }]; const c = [{ name: ...
Let's say I have a simple component like this. import React, { useState } from "react"; const Counter = () => { const [counter, setCounter] = useState(0); const incCounter = () => { setCounter(counter + 1); }; return...
I am trying to create a dynamic input form where user can add new inputs. Problem The component is not rendering when State is updated but when i open a Model that exists in the same component that is using a State to open/close it, all pushed elem...
Im wondering how I can call a method from outside of a React Functional Component. I wrote the function GetUsedLockers() which gets all the used lockers and returns amount. Now I want to call this function from another another component (OrgLocker.ts...
I have a react app that is purely built with functional components. I want to get the height of an element after it has been rendered on screen to change size of it's parent accordingly. There are solutions for class based apps but I couldn'...
The layout for the following problem looks like this: . ??? components ? ??? ModalPolicy.js ? ??? Footer ? ??? index.js ??? pages ? ??? index.js I've tried to render the Modal on Footer/index.js but it didn't show up (as the on...
I have following code: function MyComponent( props ) { let arrSize = 5; const [arr, setArr] = useState( () => { let initial = new Array(arrSize); for(let i=0; i<arrSize; i++) initial.push({ foo: 'foo', bar: '...
©2020 All rights reserved.