Category : use-state

I want to get the investments variable within the scope of another component… I have written the code down-bellow which is ok, but how can I get this const investment since I already exported the function InvestmentsList? How can that be done without resorting to useSelector() from react-redux? import React, { useEffect, useState } from ..

Read more

I have created a component inside my project: export default ({json}) =>{ const [quantProduto, setQuantProduto] = useState({ idprod: json.prod_id, amount: 0 }); const minusClick = () => { setQuantProduto(quantProduto.amount = quantProduto.amount – 1); console.log(json.prod_descricao+’ -> ‘+quantProduto.amount) } //I hid plusClick to simplify return( <Area> <Descricao numberOfLines={1}>{json.prod_descricao}</Descricao> <InputArea> <Button onPress={ minusClick }><ButtonText>-</ButtonText></Button> <Input keyboardType="numeric" >{quantProduto.amount}</Input> <Button><ButtonText ..

Read more

setter function using useState is not working inside an event listener function. visit sandbox: https://codesandbox.io/s/mystifying-austin-e9zgh click on search box, a suggestion dropdown will appear press down key, it will highlight the next item pressing down key again doesn’t works [issue], expected behavior: down key should point to next item Problem Statement: Develop a search suggestion ..

Read more

I have a catalogue type program for a school project – it pulls in a few arrays and concatenates the arrays with arrays created from user input. The only issue is that they state is always one behind so if you increase the counter to 5 and submit it will return 4 instead. Any ideas? ..

Read more

I use useState to change the amount of textarea: const [vancyValue , setVancyValue] = useState(”); When I change the value for the display, the actual value also changes. Does it make sense? Or I made a mistake somewhere. <teaxtarea id="Text1" cols="60" rows="5" placeholder="متن خود را وارد کنید!!" value={vancyValue.split(‘$%A’).join(‘…………..’)} onChange={(e) => handleChange(e)} /> note:I just want ..

Read more