Ask questionsReact custom hook "Should have a queue. This is likely a bug in React" error message.

<!-- Note: if the issue is about documentation or the website, please file it at: -->

Do you want to request a feature or report a bug? Bug

What is the current behavior? Getting this error message: Should have a queue. This is likely a bug in React. Please file an issue.

If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem. Your bug will get fixed much faster if we can run your code and it doesn't have dependencies other than React.

I tried to implement a simple data cache in a custom hook:

import { useState, useEffect } from 'react'

const get = url => {
  return fetch(url)
    .then(res => res.text())
    .then(data => JSON.parse(data))

const cache = new Map()

const useData = dataURL => {
  const [data, setData] = useState(null)
  if (cache.has(dataURL)) {
    return cache.get(dataURL)

  useEffect(() => {
    get(dataURL).then(data => {
      cache.set(dataURL, data)
  }, [dataURL])

  return data

export default useData

The entire project code is here:

Which versions of React, and which browser / OS are affected by this issue? Did this work in previous versions of React? Using React 16.8.2, Chrome, and MacOS.


Answer questions threepointone

I'm curious why you didn't see the other error messages in your app (specifically about the change in order). Closing this for now, but we may revisit if this happens again in the future, or if you have any new information to share. Thanks!

Github User Rank List