top | item 40314534

Ask HN: How do you use React as a library in 2024?

1 points| blacksoil | 1 year ago

Hi all, With most of the current trend being to use React as a framework (e.g. NextJS), is there anyone here who still uses React as a library? If so, how is your setup?

I'm asking this is because I want to go back to MVC, but I don't want to miss out on the nice libraries out there built for React. Hence I want to combine MVC + React as a library.

3 comments

order

acemarke|1 year ago

Can you clarify some terms here?

- What do you mean by "React as a library"? Using it as a pure SPA with a bundler like Vite? Using it as a plain `<script>` tag?

- What do you mean by "go back to MVC"? What does "MVC" mean specifically in this case?

blacksoil|1 year ago

- Using it as a plain `<script>` tag?

Yes.

- What do you mean by "go back to MVC"? What does "MVC" mean specifically in this case?

MVC as in Model-View-Controller.

To give more context, I'm prototyping a lot, and having to create endpoints for every single APIs is quite a chore. Also I want to avoid the overhead of having to run separate server just to host the frontend (e.g. NextJS)