React cannot parse the value of a variable
P粉769413355
P粉769413355 2023-09-10 09:25:11
0
1
282

When the onChange event occurs on the input, I want the value of the variable to change and be written to the console. But when changes occur, it writes undefined in the console. can you help me?

import './App.css';
import React,{useState,useEffect} from 'react';

function App() {
    let [message,setMessage] = useState("""");
    
    useEffect((message) => {
    console.log(message);

    },[message])
return(
<div> 
    <input type="text" onChange={e => setMessage(e.target.value)}  />
</div>

)}
export default App;

Why does undefined appear every time onchange occurs?

P粉769413355
P粉769413355

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!