import { useState } from "react";
const lists = []
const Storege = () => {
const [list, setList] = useState([])
const inputevent = (e) => {
setList(e.target.value)
}
const btnClick = (e) => {
e.preventDefault()
lists.push(list)
localStorage.setItem("Product", lists);
}
return (
<>
<div className="container w-50">
<form>
<div className="mb-3">
<label className="form-label">Enter name</label>
<input onChange={inputevent} type="text" className="form-control" />
</div>
<button onClick={btnClick} className="btn btn-primary">Submit</button>
</form>
</div>
</>
)
};
export default Storege;
Post a Comment