why am I getting always "TypeError: callback is not a function"

Viewed 111

Simple problem in React, I just want to make a simple callback to delay the loading of the data

function getSettings(callback) {
    getColors();
    callback();
  }

  useEffect(() => {
    getSettings().console.log(settings);
    // eslint-disable-next-line
  }, []);

and I get:

"TypeError: callback is not a function"
1 Answers

It looks like you're not passing your callback to getSettings(). If you're trying to pass the console.log, you could try:

getSettings(() => console.log(settings));    
Related