Custom Hooks in React
A custom hook is a JavaScript function that:
Starts with use
Uses built-in hooks like useState or useEffect
Reuses stateful logic between components
👉 Custom hooks reuse logic, not UI.
Why Use Custom Hooks?
Instead of repeating logic (fetching data, forms, pagination, auth), you extract it into one reusable function.
This keeps components:
Cleaner,Smaller,Easier to maintain
Simple Real Example
Use it inside a component:
Now the fetching logic is reusable anywhere.
Key Idea
Custom Hooks = Reusable stateful logic
They: Don’t return JSX, Don’t render UI
Only manage logic
@futurefullstack
A custom hook is a JavaScript function that:
Starts with use
Uses built-in hooks like useState or useEffect
Reuses stateful logic between components
👉 Custom hooks reuse logic, not UI.
Why Use Custom Hooks?
Instead of repeating logic (fetching data, forms, pagination, auth), you extract it into one reusable function.
This keeps components:
Cleaner,Smaller,Easier to maintain
Simple Real Example
import { useState, useEffect } from "react";
function useFetch(url) {
const [data, setData] = useState(null);
useEffect(() => {
fetch(url)
.then(res => res.json())
.then(data => setData(data));
}, [url]);
return data;
}
Use it inside a component:
const data = useFetch("https://api.example.com/data");
Now the fetching logic is reusable anywhere.
Key Idea
Custom Hooks = Reusable stateful logic
They: Don’t return JSX, Don’t render UI
Only manage logic
@futurefullstack
👍2
I’ve realized that learning without practice doesn’t really benefit me. So instead of just reading and watching tutorials, I decided to build something.
I’m starting a simple CryptoTrack website to track cryptocurrency prices, and I’ll make it have multiple pages so I can properly practice routing in React.
Time to turn learning into building 💻
@futurefullstack
I’m starting a simple CryptoTrack website to track cryptocurrency prices, and I’ll make it have multiple pages so I can properly practice routing in React.
Time to turn learning into building 💻
@futurefullstack
👍5🔥2🏆1
Just finished my first React project — Simple CryptoTracker
Real multi-page app.
Real APIs.
Real data.
🏠 Home
📊 Market
📄 Coin Details
📰 News
What this project really taught me:
• Routing like a real app
• Fetching and handling live crypto data
• Managing loading states
• Structuring components properly
Live Demo
Repo
@futurefullstack
Real multi-page app.
Real APIs.
Real data.
🏠 Home
📊 Market
📄 Coin Details
📰 News
What this project really taught me:
• Routing like a real app
• Fetching and handling live crypto data
• Managing loading states
• Structuring components properly
Live Demo
Repo
@futurefullstack
🔥4👍2
Forwarded from Abdre
was just reading some news today and it honestly blew my mind.
we mostly just use AI to help us code or write emails, but it turns out the US military has been using tools like Claude for actual combat planning. there are even reports they used AI during the recent airstrikes on Iran.
the crazy part is the drama behind it. Anthropic (the company behind Claude) actually pushed back. they drew a hard line saying they wouldn't allow their AI to be used for fully autonomous weapons. because of that, the pentagon basically cut ties with them and went looking for other companies (like OpenAI) who would agree to their terms.
it’s just wild to think about. AI isn't just our little coding assistant anymore.. it’s literally becoming the brain behind global warfare.
kind of a scary reality check today. what do you guys think about AI being used for stuff like this?
we mostly just use AI to help us code or write emails, but it turns out the US military has been using tools like Claude for actual combat planning. there are even reports they used AI during the recent airstrikes on Iran.
the crazy part is the drama behind it. Anthropic (the company behind Claude) actually pushed back. they drew a hard line saying they wouldn't allow their AI to be used for fully autonomous weapons. because of that, the pentagon basically cut ties with them and went looking for other companies (like OpenAI) who would agree to their terms.
it’s just wild to think about. AI isn't just our little coding assistant anymore.. it’s literally becoming the brain behind global warfare.
kind of a scary reality check today. what do you guys think about AI being used for stuff like this?
🗺️ Feeling lost about what to learn next?
Check out roadmap.sh — it gives clear, step-by-step roadmaps for Frontend, Backend, Full-Stack, React, Node.js and more.
Instead of randomly watching tutorials, you follow a structured path that shows:
✔️ What to learn
✔️ In what order
✔️ What actually matters
Stop guessing. Follow a roadmap.
@futurefullstack
Check out roadmap.sh — it gives clear, step-by-step roadmaps for Frontend, Backend, Full-Stack, React, Node.js and more.
Instead of randomly watching tutorials, you follow a structured path that shows:
✔️ What to learn
✔️ In what order
✔️ What actually matters
Stop guessing. Follow a roadmap.
@futurefullstack
❤5
Today I learned about TanStack Query and how it simplifies data fetching and caching in React. It’s interesting to see how it removes a lot of the complexity we usually deal with when using useEffect and manual state management.
I also tried to refactor my CryptoTracker project using what I learned. The refactoring went pretty well and the structure feels better now.
Unfortunately, there’s one bug I couldn’t debug today 😅. I’ll revisit it tomorrow with a fresh mind.
That’s it for today.
Good night everyone 🌙
@futurefullstack
I also tried to refactor my CryptoTracker project using what I learned. The refactoring went pretty well and the structure feels better now.
Unfortunately, there’s one bug I couldn’t debug today 😅. I’ll revisit it tomorrow with a fresh mind.
That’s it for today.
Good night everyone 🌙
@futurefullstack
❤4🔥1