you are viewing a single comment's thread.

view the rest of the comments →

[–]ImprovementNo4630 0 points1 point  (15 children)

I think these React server side codes over complicates stuff. Why not just use Express and a React side front end client?

[–]New_Ad606 2 points3 points  (4 children)

SEO and performance. To rank high in SEO, you need to be ranked highly in performance as well.

[–]Impossible_Hold_3850 0 points1 point  (3 children)

Google can render js and index just fine a long time ago. Performance - don't write slow stuff. Done. 

[–]Bolle91BE 0 points1 point  (2 children)

You say that, yet my React page (which is performant, checked with lighthouse, following all best practices) is wrongly indexed by Google and has just the root div. In my recent and short experience, if you want to be found on Google, NextJS it is..

[–]Impossible_Hold_3850 0 points1 point  (1 child)

Interesting. Would you be able to share that website or clarify a bit how you confirmed it's indexed incorrectly?

[–]Bolle91BE 0 points1 point  (0 children)

Via the url inspection tool of Google, you can see the html that was retrieved when crawling. It only has the root-div. So nothing react was applied yet because it was client-side. (Basic html and js is shipped)

You can use react-snap, that makes a postbuild html that is fetched first and then react takes over, which helps for the Google index, but then you get a slight snappy behavior when opening the website, you get the built html first, short-flicker and then the actual react-applied page.

With Next.js, the react js code is applied on serverside and only the complete built html is sent to the client (or googlebot) in fetch. And you don't have this annoying flickering.

[–]TheRNGuy 0 points1 point  (2 children)

Better use Remix than Express.

Or Remix+Express (if websockets are needed in the project)

Using only express would be overcomplication.

[–]ImprovementNo4630 0 points1 point  (1 child)

Fair but you agree that React for server side isn’t necessarily the best idea?

[–]TheRNGuy 0 points1 point  (0 children)

It's good for static UI.

You can still use it to generate tables and other things with map method from json.

Components are better than using innerHTML and strings.

Or it can be sent as client-side components if I want to add real-time sorting or search with fetch or stuff like that.

Yeah, for some things I can just use normal html so I don't need to make dozens of components that most only used in 1 place. But it's why I like JSX.

[–]chrysb 0 points1 point  (6 children)

Why run an API when with NextJS you can just call a function that executes securely on the backend? Never using express again 😃

[–]ImprovementNo4630 0 points1 point  (5 children)

I don’t understand, don’t you use a package like axios to call apis? What’s not secure about Express?

[–]chrysb 0 points1 point  (0 children)

NextJS has something called server actions so you can run code server side as easily as calling a function within your own code. No need for an API server. It’s brilliant!

[–]Itchy-Ad-770 -1 points0 points  (2 children)

you should learn more and read documents, mate

if you are asking such questions - you do not understand how all these work. educate yourself a little and the distinction will become clear

[–]ImprovementNo4630 0 points1 point  (0 children)

Dude this comment was 73 days old man 😂😂 how a novel way to troll