Design comparison
Solution retrospective
Feedback is always welcome, what typescript best practices would you recomend?
Community feedback
- @AlexKMarshallPosted almost 3 years ago
Hey there
This looks good. Just be careful with your html. The heading elements that you've currently got in there aren't really headings. Headings should read like a table of contents and be understandable on their own.
As for typescript. You've got the right idea. Creating a
Props
type. UsingReactNode
for children elements. ReturningJSX.Element
from a component. Those are all the building blocks of basic react typescript. There isn't much more you can do with Typescript in a project like this as it's just a static site with no interactivity. The real benefit of typescript will com when you start building apps.I would say that while creating the container component is good practice for typing the props, in this case that component isn't really giving you any benefit and you may as well just inline that
<main>
element right in the app file.Marked as helpful1@Sam-GulikerPosted almost 3 years ago@AlexKMarshall
Hi,
Thanks for the feedback, I'll keep the headings in mind for the next time. Probably just going to use different 'p' tags. The main part was just for practice, I know it's a bit to much for a project like this. I just wanted to get my feet wet with TS.
My next project is going to be bigger and using TS.
Once again thanks! :)
0 - @codezelossPosted almost 3 years ago
This comment was deleted almost 3 years ago
0@Sam-GulikerPosted almost 3 years ago@elosscode
Hi, Thanks! Have you checked the code or the error? Because it's wrapped in a main. The issue is that i'm not using a 'h1' tag.
1
Please log in to post a comment
Log in with GitHubJoin our Discord community
Join thousands of Frontend Mentor community members taking the challenges, sharing resources, helping each other, and chatting about all things front-end!
Join our Discord