Skip to content

Commit

Permalink
🎨 Refactored code and colocated state
Browse files Browse the repository at this point in the history
  • Loading branch information
AdithyaBhat17 committed Mar 13, 2021
1 parent 5ea1bb5 commit 4482f1f
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 7 deletions.
7 changes: 1 addition & 6 deletions components/HabitsList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { fetcher } from "../lib/fetcher";
import { HabitsResponse } from "../types/graphql";
import Error from "./Error";
import EditHabit from "./EditHabit";
import { useCallback, useState } from "react";
import { useState } from "react";
import { Habit as HabitType } from "../types/habit";

function HabitsList() {
Expand All @@ -23,10 +23,6 @@ function HabitsList() {

const close = () => selectHabit(undefined);

const editHabit = useCallback((title) => {
console.log(title);
}, []);

if (error || data?.code) return <Error error={error || data} />;

const habits = data;
Expand All @@ -46,7 +42,6 @@ function HabitsList() {
/>
))}
<EditHabit
editHabit={editHabit}
isOpen={Boolean(selectedHabit)}
close={close}
habit={selectedHabit}
Expand Down
1 change: 0 additions & 1 deletion types/habit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,4 @@ export interface EditHabitProps {
| "6xl"
| "full";
habit?: Habit;
editHabit: (title: string) => void;
}

0 comments on commit 4482f1f

Please sign in to comment.