I’m simply not understanding why is this happening or even how to explain it, I have this custom hook:
const useFeatures = (existingFeatures: Ft[]) => {
console.log('fts provided to state:', existingFeatures)
const [features, setFeatures] = useState(existingFeatures)
console.log('fts given by state:', features)
...
and the output is
LOG fts provided to state: [{"done": true, "ftName": "task", "name": "T"}]
LOG fts given by state: [{"ftName": "number", "label": "N", "name": "", "value": 22}]
This is happening between renders of different components that provide different “features”
I also should clarify that I’m developing a React Native App.
I know isn’t much information to post a question, but I’ve been not able to reproduce the bug outside my project.
Just wanna know if someone have experienced something similar.
Ive tried run the second console.log after a timeout or even inside a useEffect hook that takes as parameter [features]
and still got the same log