Advertisement
Guest User

Untitled

a guest
Sep 27th, 2021
200
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.00 KB | None | 0 0
  1. import React from 'react';
  2. import { useState } from 'react';
  3.  
  4. export default function Accueil() {
  5.  
  6. //submit
  7. const ConvertResult = e => {
  8. e.preventDefault();
  9. }
  10.  
  11. //input
  12. const [InputState, setInputState] = useState();
  13.  
  14. const InputContain = e => {
  15. setInputState(e);
  16. }
  17. //button
  18. const [ConvertInput, setConvertInput] = useState();
  19.  
  20. const ConvertData = () => {
  21. if(typeof InputState === 'string'){
  22. setConvertInput('?d')
  23. }
  24. }
  25.  
  26.  
  27. return (
  28. <div className="Accueil_Container">
  29. <div className="Accueil_main">
  30. <form onSubmit={e => ConvertResult(e)}>
  31. <input type="text"
  32. onInput={e => InputContain(e.target.value)}/> <br/>
  33.  
  34. <button onClick={ConvertData}>Convert</button>
  35. </form>
  36. </div>
  37. <span>
  38. {ConvertInput}
  39. </span>
  40. </div>
  41. )
  42. }
  43.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement