Pages

Simple React Use State Example

import { useState } from "react";

function Post(){

const [inval, setInVal] = useState('');


function changeTextHandler(e){

    setInVal(e.target.value);
}

    return (
        <>
        <form>
            <textarea onChange={changeTextHandler}/>
            <div>{inval}</div>
        </form>
        </>
    )
};

export default Post;

No comments:

Post a Comment

Search This Blog