TypeError:react__WEBPACK_IMPORTED_MODULE_0___default不是函数或其返回值不可迭代

Sup*_*ool 2 npm reactjs

我只是在 YouTube 上关注这个教程。useState 给出错误。

请在这里帮助我

import React from 'react'
//import useState from 'react-dom';
import useState from 'react';

export const Tindercards = () => {
    const [people, setPeople] = useState([
        {
            name: "Elon Musk",
            url:"https://...." "https://www.biography.com/.image/ar_1:1%2Cc_fill%2Ccs_srgb%2Cfl_progressive%2Cq_auto:good%2Cw_1200/MTc5OTk2ODUyMTMxNzM0ODcy/gettyimages-1229892983-square.jpg"
        }
    ]);

    return (
        <>
            <div className="tindercards">
                
            </div>
        </>
    )
}

export default Tindercards;
Run Code Online (Sandbox Code Playgroud)

这是我得到的错误

小智 15

useState 不是“react”包中的默认函数。改变:

import useState from 'react';
Run Code Online (Sandbox Code Playgroud)

import { useState } from 'react';
Run Code Online (Sandbox Code Playgroud)

您只能为模块/包中的默认函数省略花括号。