Mumma6 / learndev

https://www.studify.dev
0 stars 0 forks source link

Add eslint config file · npm run eslint-fix #85

Closed d0rsha closed 1 year ago

d0rsha commented 1 year ago

Check package.json && .eslintrc.json

vercel[bot] commented 1 year ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
learndev ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 30, 2023 4:57am
learndeviomartin commented 1 year ago

Ser att det blir ett litet byggfel i Vercel

Jag är inte helt nöjd med hur jag satt upp hooksens, dom kan ju retunera null | undefiend. Hade varit nice att ändra det till att retunera en Option istället. Kanske något ja borde kolla upp :D

pages/home.tsx:18:9

20:16:02.398 | Type error: Type 'Element | undefined' is not assignable to type 'Element'. 20:16:02.398 | Type 'undefined' is not assignable to type 'ReactElement<any, any>'. 20:16:02.398 |   20:16:02.398 | 16 | {<code>Dashboard \| ${data?.payload?.name}</code>} 20:16:02.398 | 17 | 20:16:02.398 | > 18 | {data && } 20:16:02.399 | | ^ 20:16:02.399 | 19 | 20:16:02.399 | 20 | </> 20:16:02.399 | 21 | )

Vill man vara fancy kan man göra såhär


import { pipe } from "fp-ts/function"

const home = () => {
  // Används för att få userdata i protected routes.
  const { data } = useCurrentUser()

  return pipe(
    data?.payload,
    O.fromNullable,
    O.fold(
      () => (
        <>
          <DashboardLayout>
            <p>Loading...</p>
          </DashboardLayout>
        </>
      ),
      (response) => (
        <>
          <DashboardLayout>
            <Head>
              <title>{`Dashboard | ${response.name}`}</title>
            </Head>
            <Home user={response} />
          </DashboardLayout>
        </>
      )
    )
  )
}

export default home```