-
-
Notifications
You must be signed in to change notification settings - Fork 2k
Description
Hey, hi!
I've reached out to a few people but haven’t received any replies. I thought this would be my last resort to ask for help.
Here’s my question in simple terms: How do I understand the Preact codebase?
To elaborate:
I’ve found the source files for core methods like render, diff, and the hooks implementation. I get where the logic lives. But I’m struggling to understand how you all actually develop and debug the library during development.
My plan was to:
- Run
yarn run dev - Add
console.logstatements to internal functions likerender,diff, ortoChildArray - Create an
index.htmlfile in the root and load the dev bundle to see those logs in action
However, that didn’t work — I ran into CORS issues, and couldn’t figure out how to correctly map the output to index.html. I explored the debug/ and benchmark/app/ folders but still couldn’t understand how to wire everything up for local debugging.
I also tried a similar approach with the React codebase — no luck there either.
What really sparked my curiosity is seeing how Preact internally reuses logic — like implementing useState on top of useReducer, and other elegant patterns. I want to study and explore how Preact is built the same way I learned Redux — through [Dan Abramov’s famous Redux-from-scratch gist](https://gist.github.com/gaearon/ffd88b0e4f00b22c3159).
2. Is there a minimal setup to load an index.html and test changes interactively in the browser?
3. How do contributors and maintainers usually test their changes — via the test suite, example apps, or something else?
4. Where to start if i wanna learn the internals and understand the codebase?
I’m eager to learn and dig deep into the internals of Preact. Any help or direction would mean a lot!
Thanks so much for maintaining such a great library.