Skip to content

Commit

Permalink
Create Form.js
Browse files Browse the repository at this point in the history
  • Loading branch information
KOSASIH authored Nov 20, 2024
1 parent ffa88f6 commit f78953a
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions dapps-builder/src/components/UIComponents/Form.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import React, { useState } from 'react';

const Form = ({ onSubmit }) => {
const [input, setInput] = useState('');

const handleSubmit = (e) => {
e.preventDefault();
onSubmit(input);
setInput('');
};

return (
<form onSubmit={handleSubmit}>
<input
type="text"
value={input}
onChange={(e) => setInput(e.target.value)}
placeholder="Enter your input"
/>
<button type="submit">Submit</button>
</form>
);
};

export default Form;

0 comments on commit f78953a

Please sign in to comment.