Skip to content

Instantly share code, notes, and snippets.

@greaveselliott
Last active June 23, 2019 22:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save greaveselliott/30278c6382f00f81f1f7e18f03567baf to your computer and use it in GitHub Desktop.
Save greaveselliott/30278c6382f00f81f1f7e18f03567baf to your computer and use it in GitHub Desktop.
import React, { useRef, useContext } from "react";
import { Store } from "./Store";
import { createNewListItem, deleteListItem } from "./Actions";
import "./app.scss";
export default function App() {
const { state, dispatch } = useContext(Store);
const input = useRef();
const onDeleteListItem = uuid => {
deleteListItem({
dispatch,
payload: {
uuid
}
});
};
return (
//...
<button onClick={() => deleteListItem(listItem.uuid)}>
Delete
</button>
//...
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment