The useState set method is not reflecting a change immediately
I am trying to learn hooks and the useState
method has made me confused. I am assigning an initial value to a state in the form of an array. The set method in useState
is not working for me, both with and without the spread syntax.
date-fns/intervalToDuration.mjs Can’t import the named export ‘differenceInHours’ from non EcmaScript module (only default export is available)
import PropTypes from ‘prop-types’
import { useState } from ‘react’;
import {formatDistance} from ‘date-fns’
Why in the Clousure Scope the react state didn’t change and kept empty?
I ran this react code,
Confuse about render process when using useRef in React
Here is the testing code: