frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

Open in hackernews

What is the difference between useEffect and componentDidMount in React?

1•fullstackprep•7h ago
Great question! Understanding the difference between useEffect and componentDidMount is key to mastering React’s lifecycle—especially as the ecosystem shifts toward functional components.

Think of your React component as a restaurant kitchen:

componentDidMount is like the head chef who shows up once when the kitchen opens, setting up everything needed before cooking begins. This is how class components handle tasks that should run only once after the component mounts.

useEffect, however, is more like a sous-chef who’s incredibly flexible — they can come in once when the kitchen opens, but also anytime the ingredients change, or even after every dish if you want. This hook can run once, many times, or conditionally, depending on what dependencies you give it.

In short, useEffect replaces and extends the lifecycle methods like componentDidMount, componentDidUpdate, and componentWillUnmount with a cleaner, more powerful API tailored for functional components.

If you want to write modern React code that’s easier to maintain and debug, learning when and how to use useEffect is a must.

Analysis of the 2025 IMO problems and how AI should be able to do

https://sugaku.net/content/imo-2025-problems/
1•amichail•1m ago•0 comments

Can AI run a physical shop?

https://venturebeat.com/ai/can-ai-run-a-physical-shop-anthropics-claude-tried-and-the-results-were-gloriously-hilariously-bad/
1•icetank•2m ago•0 comments

Making Project Work Better with R

https://topepo.github.io/2025-ncb-workshop/
1•the-mitr•7m ago•0 comments

Why pay for an analytics tool when Google Analytics is free?

https://plausible.io/paid-analytics-vs-free-ga
1•themeaningist•9m ago•0 comments

Show HN: Infinite Canvas for Notes

https://infinote.surge.sh/
1•stagas•12m ago•1 comments

Solving a Chaucerian mystery, and revealing a medieval preacher's meme

https://www.cam.ac.uk/stories/song-of-wade-lost-english-legend-decoded
1•geox•13m ago•0 comments

Let Me Cook You a Vulnerability: Exploiting the Thermomix TM5

https://www.synacktiv.com/en/publications/let-me-cook-you-a-vulnerability-exploiting-the-thermomix-tm5
3•todsacerdoti•14m ago•0 comments

Show HN: DataRamen, a Fast SQL Explorer with Automatic Joins and Data Navigation

https://dataramen.xyz/
1•oleksandr_dem•15m ago•0 comments

Spain awards Huawei contracts to manage intelligence agency wiretaps

https://therecord.media/spain-awards-contracts-huawei-intelligence-agency-wiretaps
1•consumer451•15m ago•0 comments

A former OpenAI engineer describes what it's like to work there

https://techcrunch.com/2025/07/15/a-former-openai-engineer-describes-what-its-really-like-to-work-there/
1•tzury•15m ago•0 comments

Sibling study finds early education boosts brain power

https://phys.org/news/2025-07-sibling-early-boosts-brain-power.html
1•PaulHoule•17m ago•0 comments

Sending Web Push Notifications from Rails

https://joyofrails.com/articles/web-push-notifications-from-rails
1•thunderbong•17m ago•0 comments

Show HN: HN v0.2.1 – Native macOS app for reading HN

https://120.dev/120-hn
2•120-dev•20m ago•0 comments

A Geek's Guide to Photography

https://lcamtuf.coredump.cx/photo_basics/
2•ibobev•22m ago•0 comments

Some States Are Pushing Back on Library E-Book Licensing Fees

https://www.nytimes.com/2025/07/16/books/libraries-e-books-licensing.html
2•donohoe•23m ago•0 comments

UK tech minister negotiated nothing with Google. He may get even less than that

https://www.theregister.com/2025/07/16/uk_gov_google_comment/
1•rntn•23m ago•0 comments

Isometric Tutorials

https://clintbellanger.net/articles/
2•ibobev•24m ago•0 comments

Procedural Content Generation in Games

https://www.pcgbook.com/
1•ibobev•24m ago•0 comments

Intigriti teams with Nvidia to launch bug bounty and VDP

https://www.intigriti.com/blog/business-insights/intigriti-teams-with-nvidia-to-launch-bug-bounty-vulnerability-disclosure-program
1•inti_bug•25m ago•1 comments

METR's AI productivity study is good

https://www.seangoedecke.com/impact-of-ai-study/
1•rbanffy•33m ago•0 comments

Jeremy Bicha – A Child Sexual Predator Built Your Desktop

https://fandompulse.substack.com/p/jeremy-bicha-a-child-sexual-predator
2•IlikeKitties•34m ago•1 comments

America's Anti-Immigrant Fever Is Starting to Break

https://www.bloomberg.com/opinion/articles/2025-07-16/gallup-poll-on-immigration-shows-anti-immigrant-fever-is-breaking
2•petethomas•37m ago•1 comments

Fibonacci(50) as a Fractal Sequence Diagram

https://app.ilograph.com/demo.ilograph.Fibonacci%2520Sequence/Fib(50)
1•billyp-rva•37m ago•0 comments

Show HN: I Recently Built a Project

3•FerkiHN•40m ago•2 comments

Show HN: Android SDK easter egg showcase

https://github.com/TrianguloY/isUserAMonkey
1•TrianguloY•42m ago•0 comments

If [ ] the user wants the latest docs, do not use 2024 in the search query

https://gist.github.com/sergeyk/b1eb7bf8fd8db2566c082409dbd3eca9
1•tosh•47m ago•0 comments

Streamline Global Client Communication with 20 Secure Accounts

1•yt1314•48m ago•0 comments

Nvidia Chip in Russian Drone with Autonomous Targeting and Engagement

https://balticsentinel.eu/8284227/ukraine-uncovers-nvidia-chip-in-russian-drone-turning-it-into-a-digital-predator-capable-of-autonomous-targeting-and-engagement
4•INGELRII•48m ago•0 comments

Can you build a company without sacrificing a healthy lifestyle?

https://join.40hourentrepreneur.com/
1•fabianoao•52m ago•0 comments

AI Turned My Simple Blog into 81 Files and 83 Dependencies

https://diqi.dev/ai-code-generation/
3•diqi•52m ago•0 comments