Hacker News new | ask | show | jobs
by frostiness 545 days ago
You absolutely can, but it's way more common to only know how to create a blank site with a framework than to migrate an existing site. React used to have a section in its documentation for how to add it to your site without adding a build system (not common knowledge, unless it's setting up a blank site through a script) and they've since replaced it with a brief tutorial telling you to migrate your website to a JS module with a link to a suggested build system.

All of this matters because the person that has to do this setup might not be you. It's certainly a problem with the frameworks themselves that porting a website (even just to add a little functionality) isn't as easy as setting one up initially but there's not really much an individual can do here. It's one reason I like frameworks like Preact so much, they're actually trying to fix this.

2 comments

You mean this: https://react.dev/reference/react-dom/client/createRoot

How you bundle react is left as an exercise to the reader but the data is still there?

>How you bundle react is left as an exercise to the reader but the data is still there?

The Francis Scott Key of web development

"...and the data was still there!"

Understood. Makes me think of YAGNI though.

https://en.wikipedia.org/wiki/You_aren%27t_gonna_need_it