Mohammed Junaid Profile picture
Sep 9, 2023 12 tweets 3 min read Read on X
Components in React.

Explained: Image
Real-Life Example:

Imagine building a house 🏠.

Each room (kitchen, bedroom, bathroom) represents a component.

React components contain particular UI and behaviour, just as rooms have particular purposes and looks.

Let's explore these "rooms" in the world of React!
🔹 Functional Components:

• Simpler and more concise.
• Stateless (initially).
• Use functions to return JSX.
• With Hooks, they've become even more powerful!

Example: Image
🔹 Class Components:

• "Component" is React's foundational class.
• Components can be defined using JavaScript classes.
• React continues to support these class components.
• Yet, they're not advised for new projects.

Example: Image
🔸 Props:

• Short for "properties".
• A way to pass data from parent to child components.
• Immutable (read-only). Image
🔸 State:

Internal data storage for components.

• this.setState() in class components.
• useState() hook in functional components.
🔸 Lifecycle Methods & Effects:

• Class components have lifecycle methods like componentDidMount(), componentDidUpdate(), etc.

• Functional components use the useEffect() hook for similar purposes.
🔸 Composition vs Inheritance:

React favours composition.

Instead of inheriting from a base component, you "compose" your UI by nesting components.

Example: Image
🔸 Higher-Order Components (HOCs):

A design pattern where a component wraps another, adding additional props or state.

Great for code reuse.

Example: Image
Components are the essence of React.

They make our UI:
• Modular
• Maintainable
• Intuitive.

Whether you opt for class or functional components, mastering their fundamentals is crucial! 🚀
Learn React in 30 Days.

📘 React Rangers: 30-Days of React!

Grab now: reactrangers.xyz
Image
That's a wrap.

Follow @mdjunaidap for more.

• • •

Missing some Tweet in this thread? You can try to force a refresh
 

Keep Current with Mohammed Junaid

Mohammed Junaid Profile picture

Stay in touch and get notified when new unrolls are available from this author!

Read all threads

This Thread may be Removed Anytime!

PDF

Twitter may remove this content at anytime! Save it as PDF for later use!

Try unrolling a thread yourself!

how to unroll video
  1. Follow @ThreadReaderApp to mention us!

  2. From a Twitter thread mention us with a keyword "unroll"
@threadreaderapp unroll

Practice here first or read more on our help page!

More from @mdjunaidap

Apr 18
If you’re running Meta Ads and not tracking THIS,

you’re not just guessing—you’re wasting money.

A quick thread on the most common $500+ mistake beginners make (and how to fix it):
Meta’s algorithm is smart—but only if you feed it the right data.
The #1 way beginners waste their budget?

Broken or missing pixel setups.

No pixel = no learning
No learning = wasted ad spend
The Meta Pixel tells the platform:

• Who clicked
• Who converted
• What actions they took
• Which ad drove the result

No pixel = Meta has NO idea what success looks like.
Read 6 tweets
Jan 31, 2024
Master React for FREE.

Build 70+ React Projects: 🧵
1. 5 Top-Notch Projects to learn React
youtube.com/playlist?list=…
2. Code 15 React Projects - Complete Course
Read 7 tweets
Dec 30, 2023
Master React for FREE.

Build 70+ React Projects: 🧵 Image
1. 5 Top-Notch Projects to learn React
youtube.com/playlist?list=…
2. Code 15 React Projects - Complete Course
Read 7 tweets
Dec 28, 2023
HTML & CSS in 50 Days: Image
Days 1-5: HTML Basics

➔ Introduction to HTML
• What is HTML?
• HTML Syntax
• Elements and Tags

➔ Basic HTML Structure
• Head, Body, Title
• Paragraphs, Headings

➔ Project:
• Simple Personal Bio Page
Days 6-10: HTML Intermediate

➔ Links and Images
• Internal, External, Anchor Links
• Adding Images, Alt Text

➔ Lists and Tables
• Ordered, Unordered, Nested Lists
• Basic Table Structure

➔ Project:
• Simple Blog Page
Read 13 tweets
Dec 26, 2023
Master React.

Thread: Image
1. Project Idea 🔨 :

A Static Landing Page for a Product

➩ Description:

Create a responsive landing page for an imaginary product.

This will introduce you to basic component structures and styling in React.
➩ Features:

• Hero section with a call-to-action.
• Product features section.
• Testimonials carousel.
• Footer with social links and a newsletter sign-up form.
Read 16 tweets
Nov 4, 2023
useCallback in React.

Explained: Image
What is useCallback?

• useCallback is a hook that returns a memoized version of a callback function.

• What this means is that it helps in avoiding the recreation of functions on every render.
• This is particularly useful when passing callbacks as props to highly optimized child components.
Read 11 tweets

Did Thread Reader help you today?

Support us! We are indie developers!


This site is made by just two indie developers on a laptop doing marketing, support and development! Read more about the story.

Become a Premium Member ($3/month or $30/year) and get exclusive features!

Become Premium

Don't want to be a Premium member but still want to support us?

Make a small donation by buying us coffee ($5) or help with server cost ($10)

Donate via Paypal

Or Donate anonymously using crypto!

Ethereum

0xfe58350B80634f60Fa6Dc149a72b4DFbc17D341E copy

Bitcoin

3ATGMxNzCUFzxpMCHL5sWSt4DVtS8UqXpi copy

Thank you for your support!

Follow Us!

:(