Build a Complete Typescript React Fitness Application for Beginners | Responsive
Fitness has become an essential part of our lives, and creating a fitness application can be a great way to help people achieve their health and fitness goals. In this article, we will learn how to build a complete TypeScript React fitness application for beginners, making it responsive and easy to use for users on different devices.
Setting up the Project
The first step is to set up our project. We will need Node.js and npm installed on our system. Once we have that, we can create a new React application using create-react-app.
npx create-react-app fitness-app --template typescript
This will create a new TypeScript React application in a directory called “fitness-app”.
Creating the Foundation
Now that we have our project set up, let’s start by creating the foundation for our fitness application. We will create a few components such as a header, footer, and a main content area.
We can create a new folder called “components” in the src directory and create our components inside it.
Header Component
Create a new file called “Header.tsx” and add the following code:
<header>
<h1>Fitness App</h1>
</header>
Footer Component
Create a new file called “Footer.tsx” and add the following code:
<footer>
<p>© 2021 Fitness App. All rights reserved.</p>
</footer>
Main Content Component
Create a new file called “MainContent.tsx” and add the following code:
<main>
<h2>Welcome to Fitness App</h2>
<p>Start your fitness journey today.</p>
</main>
Creating the Layout
Now that we have our components ready, let’s create the layout for our fitness application. We will use a flexbox layout to arrange our components.
Create a new file called “App.tsx” in the src directory and add the following code:
<div>
<Header />
<MainContent />
<Footer />
</div>
Making it Responsive
To make our fitness application responsive, we can use CSS media queries to apply different styles based on the device screen size. We can create a new file called “App.css” in the src directory and add the following code:
@media screen and (max-width: 768px) {
body {
background-color: lightblue;
}
}
Running the Application
Finally, we can run our fitness application using the following command:
npm start
This will start the development server, and our fitness application will be accessible at http://localhost:3000 in your browser.
Conclusion
In this article, we have learned how to build a complete TypeScript React fitness application for beginners. We started by setting up our project, creating the foundation components, and then creating the layout. We also made our application responsive using CSS media queries. By following this tutorial, you can create your own fitness application and help people achieve their fitness goals.
Hey all, this video is more for beginners and beginners in Typescript. I do my best trying to explain things a bit more thoroughly, so let me know what you think!
Questions and Discussions about this project can be asked here in discord: https://discord.gg/2FfPeEk2mX
Hola, tengo un problema no se me incluyeron las assets solo (react.svg) sin embargo los demas archivos como png no se me exportaron. Alguna solucion para ello? Saludos.
pls use word wrap view when typing in vs code.
why in yours is .cjs and mine is .js on tailwind config?
pls what's the google chrome extension you used to view the div in the website
i noticed sometimes you created variables and it was not needed at that point in time but to be used later, it will be nice not to because it causes confusion sometimes. But generally this was a great video and it helped my typescript knowledge👍🏼
You are developing this on a Mac correct? How difficult would this be to follow on a PC?
It was amazing
you have the talent to teach
Great tutorial. Thank you
There is a bug, if you go to the page and open the navigation bar on mobile, benefits is active, but in reality home should be active. When you scroll down and then scroll back to the top, it works fine. How to fix it?
19:20 if you see prettier error like this Error [ERR_REQUIRE_ESM]: require() of ES Module c:Users…node_modulesprettier-plugin-tailwindcssdistindex.mjs not supported. You can fix it: module.exports = {
plugins: ["prettier-plugin-tailwindcss"],
};
hello, i already talked on discord, when i clone the repo to cloudflare the tailwind doesn't work
Thank you, the help me alot. Thanks once again keep up the good work
Another project where I strip away the typescript noise
thank you so much 🙂
😍
Thank you!)
done
Hi and thanks for share this excellent material, I have the question about the node and npm version that you are using on your project. I'm having some problems with prettier and tailwindcss configuration files. Possible by node version. Many thanks for the content.