react-state Questions

2

Solved

I want to store React component in React state but I think it is technically wrong. What you think about that? Example const LayoutContext = createContext(null as unknown as { setSidebarCont...
V2 asked 26/9 at 11:56

3

Solved

I have tried everything I can think of, but I cannot prevent the placeholder in react-select from disappearing (I assume changed to display: none because it is no longer in the HTML) when a value i...
Alyworth asked 19/5, 2020 at 16:15

1

Solved

I'm developing one of my projects with React, and I need to create some list where each item represents a table row, and is dependent on the previous line (and partially on the next line) - similar...
Kreplach asked 27/4 at 15:57

5

Solved

I've this simple store interface CartState { cart: { [id: string]: CartDto }; addItem: ({ id, image, name, price }: Omit<CartDto, "quantity">) => void; removeItem: (id: string...
Pentapody asked 2/11, 2021 at 16:40

6

I try to import the chatbotcontext in order to get access to current chatbot in edit, but something went wrong. Do you have ideas what could be the issue here? Here is the error message: Here is a...
Prosperus asked 31/3, 2020 at 8:46

3

Solved

I've built several modals as React functional components. They were shown/hidden via an isModalOpen boolean property in the modal's associated Context. This has worked great. Now, for various reas...
Fleshpots asked 14/11, 2019 at 7:19

1

import { useState } from "react"; export default function App() { const [buttonClicked, setButtonClicked] = useState(false); console.log('Render'); return ( <div className=&quot...
Soundboard asked 14/7, 2023 at 20:26

5

Solved

I'm using React hooks for app state, I wondered about how to initialize the function component state using props? The useState hook doc says something definitive like, const [count, setCount] = use...
Emaciated asked 11/12, 2019 at 15:53

23

Solved

I have a simple react component with the form which I believe to have one controlled input: import React from 'react'; export default class MyForm extends React.Component { constructor(props) { ...
Molokai asked 25/5, 2016 at 3:50

5

Solved

I am trying to make 3 select dropdowns automatically change based on the selection. First dropdown has no dependencies, 2nd depends on first, and 3rd depends on 2nd. This is a very simplified versi...
Apologue asked 12/12, 2022 at 18:46

3

Solved

With a basic form/input layout, it's clear that a callback should be used for state changes from child to parent (initiated by child), but how can the parent ask the child component to re-assess it...

1

Solved

I am using a React functional component where I want to update only a specific field of the state and retain the other values like before. Here's the state initialization - const[value, setValue] =...

1

I am testing a combobox on first render the initial value of the combobox is undefined. Then using query parameters and a useEffect the the component find the relevant option and sets the value sta...

4

Solved

I know there are similar questions, but I can't find out why the error happens. Div shows, but then app crashes (as if was some length problem) Code is similar to examples I found, like this sandb...
Spalla asked 12/7, 2019 at 5:25

2

Solved

I am working on a chat application using React and socket.io. Back end is express/node. The relevant components are: Room.js --> Chat.js --> Messages.js --> Message.js messageData received...
Unprepared asked 11/1, 2022 at 18:36

1

Solved

I am trying to figure out how lifting states work. Currently, I am trying to use onPress in a different component to change the state. In the snack demo I provided below, ListHome and MapHome do no...
Interfaith asked 13/9, 2021 at 5:17

4

Solved

This question has been going round and round in my head since I read the release notes (and other related hype) around React 0.14 - I'm a big fan of React and I think that stateless components (htt...

14

Solved

I am currently learning hooks concept in React and trying to understand below example. import { useState } from 'react'; function Example() { // Declare a new state variable, which we'll call &qu...
Diaphaneity asked 6/11, 2018 at 4:56

2

Solved

I am trying to create a state variable named hidden to be a dictionary (ex: [{'cutomkey1':'somevalue', 'customkey2':'somevalue'}]). hidden can be empty [{}]. In one of my methods I want to push an ...

4

Solved

I am developing a library Next.js application. For the purposes of this question, I have two pages in my application: BooksPage which lists all books, and BookPage which renders details of a book. ...
Audit asked 1/9, 2020 at 13:7

2

I'm creating a generic function to change the state. The error message: TS2345: Argument of type '() => { [x:string]: string }' is not assignable to parameter of type 'IUserSignUpState | Pick...
Gettogether asked 12/7, 2019 at 9:20

1

Solved

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...

1

Solved

I am new to React with Typescript and I am getting an error stating : No overload matches this call. Overload 1 of 2, '(props: Readonly<{}>): IndexPage', gave the following error. Type '{...
Cutcheon asked 4/1, 2020 at 22:14

3

Solved

Okay, I already know one way to do this. However, I am asking this in case I am reinventing the wheel since I am very new to React. I was under the impression that if a parent component passes her ...
Simulation asked 23/11, 2019 at 9:19

3

Solved

EDIT Sorry for showing wrong use-case. All inputs inside the Form are being passed though this.props.children, and they can be situated at any deep point of the components tree, so the approach of...
Armbruster asked 11/4, 2019 at 21:3

© 2022 - 2024 — McMap. All rights reserved.