Created
May 9, 2020 14:23
-
-
Save sumitkharche/f08a2816367b2ad16f9b500c5e1715a1 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { useState } from 'react'; | |
import { Stack,TextField, PrimaryButton } from "@fluentui/react"; | |
function AddTodo(props:any) { | |
const [todoName, setTodoName] = useState(""); | |
const addTodo = () => { | |
props.addTodo(todoName); | |
setTodoName(""); | |
} | |
const setTodo = (e: any) =>{ | |
setTodoName(e.target.value); | |
} | |
return ( | |
<Stack> | |
<Stack horizontal > | |
<Stack.Item grow> | |
<TextField placeholder="Add new item" value={todoName} onChange={setTodo }/> | |
</Stack.Item> | |
<PrimaryButton onClick={addTodo} >Add</PrimaryButton> | |
</Stack> | |
</Stack> | |
); | |
} | |
export default AddTodo; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment