Category "react-hooks"

I want to change state of the component without reloading metro in react-native

so basically i have bunch of apps in my application as you can see in image In my app it check if application is installed or not, if its installed its shows op

react-bootstrap-table-next onclick(row) not providing correct key/value information

I'm attempting to add an onClick() event to a cell in a row so that I can get the keyField value for that row when the cell is clicked. This functionality worke

In react class based component this.setsate is used but state is not defined in constructor if I have to convert this in functional based then how

class Dashboard extends Component { constructor(props) { super(props) this.state = { assetList: [], assetList1: []; } } componentD

How to access one function from one react component to another

Hi I want that when someone click on backproject I want to set my modal component display to block currently its set to none but when I add that function in App

Switch active buttons using useState and useEffect Hooks for Buttons in JavaScript/React?

I am trying to write a useState() Hook, and perhaps add useEffect() to solve active state on two buttons. It is Delivery buttons that needs the first button-del

How to fix loading spinner when using useEffect Hooks with dependency list?

I am facing one problem when trying to add a spinner. My problem is when I add "product" dependency in useEffect hooks then my loading spinner always spinning a

Update custom hook's variable after initial call

I created a custom fetch hook called useFetch() and initialled it in my App.js component, to render a list of movies when the web app loads up the page. I am tr

React - Why is geolocation state undefined when accessing it from another function

I'm trying to get the latitude and the longitude from geoLocation and use it to fetch data from a weather api. The problem however is that as soon as I pass lat

Changing the data in a child component without changing it in the parent

I am making changes to a set of data and the data is held in a parent components state I pass that data to a 2nd component but when I make changes to the data i

why can't i use useState in react

When I want to use useState, one of the hooks structures, in react, he gets angry with me const [apple, setApple] = useState(false). I have never encountered su

Material-UI-Search Bar value not clearing

I am using the @material-ui-searchbar to filter data. I'm using the same container for multiple different pages to display the info. When ever I switch between

Memoized functions to custom hook not picking up updated value from hook

Given a small hook defined as const useCount = ({ trigger }) => { const [count, setCount] = useState(1) const increment = () => setCount(count => c

Is it recommended to pass setters from useState as props?

I am currently in a coding bootcamp and the instructor told me that it is not best practice to pass the setters defined in my useState as props to children comp

How can I run React with hooks in an iFrame

I am writing a React application in which I would like to dynamically render React components through an iFrame. I have a code editor on the webpage that allows

How to re-render react-table in .js when data changes in another .js

I am new to react-table and trying to re-render a react-table when data supplied to it changes. Is there anyway to do so? I have tried using useEffect() with no

A problem that i am having making conway's game of life in react (nextjs). when i press the Random button while it is running, it starts flickering

Here is a the code for you to try. both button works fine while the game is paused or running very fast, but if i set the timeout above 100 or 200 ms and the ga

A problem that i am having making conway's game of life in react (nextjs). when i press the Random button while it is running, it starts flickering

Here is a the code for you to try. both button works fine while the game is paused or running very fast, but if i set the timeout above 100 or 200 ms and the ga

Target map()'ed items one by one

I want to create a contact form where the form fields are changed after they are filled. For example when you fill the email field, you press enter or click the

How can I render only once an Alert component in react native?

How can I render only one time an Alert component in react native if my dashboardScreen is being render many times? I'm using Context api, if I dispatch an acti

React hooks: Why do several useState setters in an async function cause several rerenders?

This following onClick callback function will cause 1 re-render: const handleClickSync = () => { // Order of setters doesn't matter - React lumps all state