简体   繁体   中英

Why when I have only 1 export default in the file, it still doesn't export?

I don't get why I keep receiving an error like this:

Uncaught (in promise) SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON data

import React, {
  useEffect
} from 'react';
import Tmdb from './Tmdb';

export default () => {

  useEffect(() => {
    const loadAll = async () => {
      // Pegar a Lista Total
      let list = await Tmdb.getHomeList();
      console.log(list);
    }

    loadAll();
  }, []);

  return (
     <div>
    Hello World!
    </div>
  );
  

}

the JSON at the start of the code has to have a variable to set on like this: {"example":useEffect}

And remember to add quotations in the html code, it could mess up the code.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM