Closed eduenez33 closed 1 year ago
Hey, I noticed that you removed the test file and there are no tests for the Heading component, can you add some?
Hey @kevinfalting, am I just recovering the test file that I removed or making a new test for the heading component?
Whatever you think would be best. I might start by using what was there, and potentially end up with something entirely different. Writing unit tests can be hard to wrap your head around, so it's something we can focus on when we meet again. 👌
Overview
Created directory
eventual/src/heading
with the fileeventual/src/heading/heading.tsx
which holds theHeading
component that takes a prop of title as a type of string. TheHeading
component is then used ineventual/src/App.tsx
that takes a hardcoded title prop. resolves #6Thought Process
At first I wrote the
Heading
component as it was taught here and it looked likefunction Heading({title}: {title: string;}) {return (<h1> { title } </h1>);}
I tested if a simple arrow function would work and it did and left it like that as it was less linesI decided to the take the prop typing and put them in an interface so it looks cleaner
Testing Steps
npm start
in the terminalHeading
title prop<Heading title="[ your sting here ]" />
Risks
Title prop is NOT optional and has to be specified. Has to be a type of string