Questions about REACT js

Somewhere on google searches I was reading that REACT is NOT made to create multiple page websites, and that you need to use a Router… So, I know how to link different pages together in REACT, but then questions …

Is is OK to build multiple page websites with REACT?

Can REACT handle blogs?

Can REACT handle connection with MongoDB databases?

Would there be any sort of problem on building a larger website with REACT?

I ask because apparently REACT is made to build single page apps?

One reason I would like to use REACT is because it allows me to create a single component that can be posted in different pages, and if I need to change something in that component it is changed in all the places I posted it without having to go changing information page by page.

WordPress has similar capabilities on creating components and placing them in different locations, but I kind of don’t want to use the WordPress platform, and want to find other alternatives.

So, REACT seems to be like a good alternative to create components and save time on changing code on a bunch of different places. I also would like to integrate BootStrap, MongoDB, create a blog, and build a site that would be getting a bit larger than just a single page app. Can I do all of that with REACT?

React, as described in the docs is

A JavaScript library for building user interfaces

Nothing less, nothing more.

This means that, according to the tools you integrate with it, you can have lots and lots of other uses for it.

For example, if you then add a Router, you can make a SPA.

If you use it with a node server, you can have a Server rendered app, using something like Next.

But you can also pre-render your whole content using a site generator like Gatsby.


As you can see, you can develop a very wide variety of project using React as a UI library.

To then answer your question you can develop all sorts of website using React. Among those I personally fancy:

  • Nextjs (link above)
  • Gatsby (link above)

Choosing any one of the above will help you in developing a blog.
But I am sure there are many more you can pick from.

Hope this helps :slight_smile:

[edit]
I realised that eleventy is in fact not a react-based static site generator.
Still a cool project tho :sunglasses:

eleventy

1 Like

Hello,
Using a router won’t necessarily change your application to a multiple-page application.

If your browser loads a new page that you clicked without needing to refresh you’re inside a single page application even if the URL changes.

Maybe you are confusing Single Page Websites with Single Page Applications.

It’s not designed for that, it’s designed to build websites, that tech already existed and is fine.

It can be used for templating multi-page websites: this is what Gatsby and Next.js do.

Again, it’s not for building websites, the technology already existed to do this fine. Again though, Next/Gatsby/etc will work fine for that purpose, and they use React.

Do you mean “can JAVASCRIPT handle connection with databases”. Yes, but React is for building UI, it’s not a database communication tool, it doesn’t care.

Only React? Yes, because React isn’t for building websites.

React for an application-like piece of functionality on a page of a website? No.

Some framework for building websites that uses React to create the UI (Gatsby/Next/etc etc)? No.

Yes, it is

All server-side web frameworks and all static site generators, in any language, have this capability; it’s just a case of generating the HTML using some templates

Yes, but it’s not what it’s designed to do and it’s a. overly complex for what you describe, and b. you’d end up with a single page application, not a website.

Next.js will work fine. Or for a blog just Google “static site generator”, which are normally simpler still; for a blog I’m not sure why you would need a database

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.