React Typescript(Basics, Mobile First, Responsive)
Design comparison
Solution retrospective
Hi everyone! This is my first react typescript projects. Any suggestions are highly appreciated. Thanks.
Community feedback
- @sophiebushchakPosted over 3 years ago
Hello, I think somehow you have placed the incorrect link on your submission, because in the preview it shows the login to Vercel.
I have looked at the solution though and it looks very nice. But I am wondering, why would you build this in React? There is nothing dynamic in the page. Were you practicing creating components and the React application structure?
0@jhunxeinPosted over 3 years agoHello @sophiebushchak. Thank you for your feedback.
Yes I'm practicing react and getting comfortable with it along with typescript. I still have a long way to go tho, so wish me luck. 😅
0 - @poppaPosted over 3 years ago
Nice job.
In a real-world situation it would probably be preferable to create separate components for your input and button in the FormEmail component.
To get better use of TS you can create your functional components like this:
// The return type of MyComponent will be inferred via React.FC // `children` are always part of the FC props and known to TS export const MyComponent: React.FC = ({ children }) => { // Component code }
And in the case your component takes props:
interface MyComponentProps { name: string // Required prop email?: string // Optional prop age?: number // Optional prop } // The return type and prop-types will be inferred via React.FC export const MyComponent: React.FC<MyComponentProps> = ({ name, email, age }) => { // We know `name` MUST be set // `email` and `age` might be `undefined` }
Happy coding!
0@jhunxeinPosted over 3 years agoHello sir @poppa. Thank you for your response. I'm still exploring ways to improve my typescript implementations sir and I'll try it to incorporate into my code and see what I could come up with this. Thank you again. 🙏
0
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