🍏 iOS / Mac OSInstall iOS 27 today — there’s no reason to wait(12.09.2026 um 15:00 Uhr)
🔧 AI Nachrichten How I’m using Codex and ChatGPT on my Mac(01.09.2026 um 00:00 Uhr)
🕵️ SicherheitslückenProFTPD mod_sql post-authentication SQLi RCE(06.09.2026 um 18:21 Uhr)
🕵️ Sicherheitslücken[remote] CVE-2026-42167 - ProFTPD mod_sql post-authentication SQLi - RCE(25.08.2026 um 02:00 Uhr)
🕵️ Sicherheitslücken[webapps] C-MOR 6.0104 - Cross-Site Scripting (XSS)(31.08.2026 um 02:00 Uhr)
🕵️ Sicherheitslücken[webapps] CubeCart 6.7.4 - Stored XSS(31.08.2026 um 02:00 Uhr)
🍏 iOS / Mac OSInstall iOS 27 today — there’s no reason to wait(12.09.2026 um 15:00 Uhr)
🔧 AI Nachrichten How I’m using Codex and ChatGPT on my Mac(01.09.2026 um 00:00 Uhr)
🕵️ SicherheitslückenProFTPD mod_sql post-authentication SQLi RCE(06.09.2026 um 18:21 Uhr)
🕵️ Sicherheitslücken[remote] CVE-2026-42167 - ProFTPD mod_sql post-authentication SQLi - RCE(25.08.2026 um 02:00 Uhr)
🕵️ Sicherheitslücken[webapps] C-MOR 6.0104 - Cross-Site Scripting (XSS)(31.08.2026 um 02:00 Uhr)
🕵️ Sicherheitslücken[webapps] CubeCart 6.7.4 - Stored XSS(31.08.2026 um 02:00 Uhr)

🔧 Programmierung 🕛 vor 2 Monaten 2 Min Lesezeit
0

Function Components - The 4 Ways Explained

↗ Quelle (dev.to)
🗣️ Stimme:
📑 Inhaltsübersicht

CODE
// 1. The Classic Way
export default function CompName(){return (<>...</>)}
// 2. The Cool Short Way
const CompName = () => {return (<>...</>)}
// 3. The Old TypeScript Way
const CompName: React.FunctionComponent<{ message: string }> = ({ message }) => ( <div>{message}</div> );
// 4.Short version of #3
const CompName: React.FC<AppProps> = ({ message }) => <div>{message}</div>;









Think of it like introducing yourself...



Imagine you're telling someone your name. You can say it in different ways:



"Hi, I'm Pramod!"

"My name is Pramod"

"You can call me Pramod"



They all mean the same thing, but some ways feel more natural!









The 4 Ways Explained






1️⃣ export default function CompName() — The Classic Way






CODE
export default function CompName() {
return <div>Hello!</div>
}






Like saying "Hi, I'm Pramod!" — clear, simple, everyone understands it instantly.



✅ Best for pages and big components

✅ Easiest to read

✅ Works great in .jsx and .tsx









2️⃣ const CompName = () => — The Cool Short Way






CODE
const CompName = () => {
return <div>Hello!</div>
}







Like saying "Call me Pramod" — a bit shorter, still totally fine.




✅ Popular in modern React

⚠️ Can't be used before it's written in the file (unlike #1)









3️⃣ React.FunctionComponent<{message: string}> — The Old TypeScript Way






CODE
const CompName: React.FunctionComponent<{ message: string }> = ({ message }) => (
<div>{message}</div>
);







Like wearing a name tag with your full title — "Hello, my name is Pramod Kumar Boda" 😅




❌ React team says don't use this anymore

❌ It used to auto-include children prop (caused bugs!)

❌ Too verbose









4️⃣ React.FC<AppProps> — Short version of #3






CODE
const CompName: React.FC<AppProps> = ({ message }) => <div>{message}</div>;







Same as #3, just shorter. Still the same problems.




❌ Also not recommended anymore (same reasons)



🏆 Expert Answer: Use #1 or #2
























Situation Use This
Pages, big components #1 function CompName()
Small utility components #2 const CompName = () =>
TypeScript props? Just define a separate type or interface





The Expert TypeScript way today 👇






CODE
// Define props separately (clean!)
type ButtonProps = {
label: string;
onClick: () => void;
}

// Use #1 or #2 — NOT React.FC
export default function Button({ label, onClick }: ButtonProps) {
return <button onClick={onClick}>{label}</button>
}






Simple rule: Just avoid React.FC and React.FunctionComponent — they're old habits. Use plain functions with typed props instead! 🎉

Vollständiger Original-Bericht
Ausführliche Details, Code-Beispiele & Hersteller-Stellungnahme auf dev.to.
↗ Original-Artikel auf dev.to lesen
Wie bewertest du diesen Beitrag?
1 Klick Feedback
Teilen mit Netzwerk & Team:

Community-Analysen & Experten-Meinungen 0

Verfasse deine eigene Analyse, teile Workarounds oder diskutiere diesen Vorfall im Blog.
Noch keine Community-Analyse verfasst. Markiere einen Textabschnitt oder klicke oben auf Eigene Analyse verfassen“!
Community Pulse: Relevanz-Einschätzung
1 Klick Experten-Votum
🔴 Akute Relevanz 0%
🟡 In Evaluierung 0%
🟢 Keine Auswirkung 0%
Spannende Innovation 0%
Verwandte Story-Cluster & Quellen (Vektor-KI)
Port 8095 Engine
1 Quelle
Windows 10 und 11: Update zerschießt Druckfunktion und PDF-Export
1 Quelle
Nvidia killt Windows-10-Support - Bald keine Game-Ready-Treiber mehr
1 Quelle
Windows 10 weiter stabil - die Nutzerzahlen im August 2026
Ähnliche Beiträge
🔍 Verwandte News

Auch interessante Nachrichten Function Components - The 4 Ways Explained

Thematisch verwandte Begriffe: Function, Components, Ways, Explained · 6 Treffer

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...