delete logic changed to work even after page refresh
This commit is contained in:
parent
94577a383c
commit
2988821828
6 changed files with 16 additions and 39 deletions
|
|
@ -11,8 +11,7 @@ import { typesContext } from "../../contexts/typesContext";
|
|||
import { useContext } from "react";
|
||||
|
||||
export default function GenericNode({ data }) {
|
||||
const {types} = useContext(typesContext);
|
||||
console.log(types, data.type)
|
||||
const {types, deleteNode} = useContext(typesContext);
|
||||
const Icon = nodeIcons[types[data.type]];
|
||||
|
||||
|
||||
|
|
@ -26,7 +25,7 @@ export default function GenericNode({ data }) {
|
|||
/>
|
||||
<div className="truncate">{data.type}</div>
|
||||
</div>
|
||||
<button onClick={data.onDelete}>
|
||||
<button onClick={() => {deleteNode(data.id)}}>
|
||||
<TrashIcon className="w-6 h-6 hover:text-red-500"></TrashIcon>
|
||||
</button>
|
||||
</div>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue