Lesson 4 - Create Footer Component
Explanation of Footer.jsx
Code Structure
Footer.jsx
Code StructureThe Footer
component provides the footer section of the app, including copyright information and links to social media platforms. Here's a step-by-step breakdown:
1. Importing Libraries
React: Required to build the component.
Bootstrap: Used for styling the footer and ensuring responsiveness.
2. Component Declaration
Purpose:
Define the
Footer
as a stateless functional component.No props are required since the content is static.
3. Footer Layout
footer
Tag:Represents the footer of the page.
Styled with
bg-dark
(dark background) andtext-light
(light text) classes.py-4
: Adds vertical padding for spacing.mt-5
: Adds top margin to separate it from the main content.
4. Copyright Information
Displays copyright information:
©
: HTML entity for the copyright symbol.2025, KOIDA BookShelf
: Static text representing the app name and copyright year.
5. Social Media Links
d-flex justify-content-center
:Creates a flexbox layout to horizontally align the links.
Links:
Each link directs users to a social media platform (
Instagram
,YouTube
,Facebook
, andX
).target="_blank"
: Opens the link in a new tab.rel="noopener noreferrer"
: Improves security for external links.
Font Awesome Icons:
Each link uses an icon (
fab fa-[platform]
) for a better visual experience.Ensure Font Awesome is included in your project to render icons.
6. Exporting the Component
Purpose:
Makes the
Footer
component reusable in the parent application.
Key Takeaways for Students:
Bootstrap Styling:
Use classes like
bg-dark
andtext-light
for predefined styles.Utilize flexbox utilities (
d-flex justify-content-center
) for alignment.
Social Media Links:
Ensure links are secure with
target="_blank"
andrel="noopener noreferrer"
.Enhance visual appeal with icons from libraries like Font Awesome.
Static Content:
Learn how to create a component with static, non-dynamic data.
Component Integration:
The
Footer
component is standalone and ready to be included inAppBookShelf.jsx
.
Last updated