Skip to content

Instantly share code, notes, and snippets.

@sumitkharche
Created May 9, 2020 14:23
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sumitkharche/f08a2816367b2ad16f9b500c5e1715a1 to your computer and use it in GitHub Desktop.
Save sumitkharche/f08a2816367b2ad16f9b500c5e1715a1 to your computer and use it in GitHub Desktop.
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