REACT
노마드코더 useState 예제
Made Project
2020. 7. 8. 17:18
import React, { Component, useState } from "react";
import "./styles.css";
const App = () => {
const [count, setCount] = useState(0);
const [email, setEmail] = useState("");
const updateEmail = e => {
const {
target:{value}
} = e;
setEmail(value);
};
return (
<>
{count}
<button onClick={() => setCount(count + 1)}>Increment </button>
<button onClick={() => setCount(count - 1)}>Decrement </button>
<input placeholder="Email" value ={email} />
</>
);
};
export default App;