Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does "isomorphic React" mean?

I was going through React tutorials and on the web I saw a lot about isomorphic React. Just got confused on what it is and how it works.

My understanding is that "isomorphic React" is an application is that it loads all the data required at start-up and then it keeps rendering on the client side as per user's request, holding the complete data in store (Redux architecture).

Now what if I have a scenario like I need to load my complete HTML form using webservice from a 3rd party application where I get the data from it as a json (schema of what fields need to be rendered on the screen) and upon performing some action I need to send the request back so that I will get some other schema to load it as my next screen.

In this scenario how do I use isomorphic, as every time I need to make a server call or an ajax call (which I do not like to do as it might expose the APIs).

So in this case can I say this application as isomorphic or my understanding with regard to isomorphic is completely wrong?

like image 684
Pathfinder Avatar asked Mar 28 '17 08:03

Pathfinder


People also ask

What is isomorphic in React?

Isomorphic: "corresponding or similar in form or relations". With regard to web apps, this means that the server is somehow similar to the client - in the sense that the server is capable of rendering as much as the client.

What does isomorphic mean in JavaScript?

The combination of client and server rendering is known as Isomorphic JavaScript. Isomorphic JavaScript is one of those fancy sounding computer science terms. Isomorphic means the application uses the same rendering engine on the client and the server, thus making it easier for developers to maintain markup templates.

What is isomorphic rendering?

Isomorphic JavaScript means that the application uses a similar rendering engine on the server and the client. This rendering method makes it easier for developers to maintain markup templates, simplifying web development. Isomorphic rendering implies the use of Node. js/Io.

What is isomorphic programming?

An isomorphism is a mapping for which an inverse mapping also exists. It's a way to describe equivalence. In programming, you often have the choice to implement a particular feature in more than one way. These alternatives may be equivalent, in which case they're isomorphic.


2 Answers

Isomorphic: "corresponding or similar in form or relations".

With regard to web apps, this means that the server is somehow similar to the client - in the sense that the server is capable of rendering as much as the client. In a way, isomorphic web apps are a return to the old paradigm where the server would render data and then send it pre-rendered to the client (think PHP templates or Ruby erb).

Specifically with isomorphic React, this means that the server renders the initial HTML for the client using React components and React.renderToString(). This eliminates double work such as having erb templates on the server side when using Rails but then using Handlebars for client-side templates and also avoid the FOUC. You can just use React for everything.

Now, if you're using a 3rd party service, you'd just use the json data as usual. What would make your app isomorphic or not would be whether your own server uses the same templating engine as your front-end. Any third party services you might consume have no bearing on whether your app is isomorphic or not.

like image 188
Pedro Castilho Avatar answered Sep 21 '22 07:09

Pedro Castilho


Understand Isomorphic at high level.

Server driven world : In this world, when user open a page in the browser, there are lot of interaction happened between client(browser) and server. In order to load page in the browser, the browser and server go to work by sending request and rendering to provide a webpage to the user. In this world, server was in charge of rendering each page in response to user interaction. For example; if user click on submit button then request goes to server with the data user entered in the form and in response server will return the new HTML with data to the browser to show next screen. Here server is responsible for UI too along with business logic and data model. This approach has many advantage and disadvantage.

Client driven world or Single page application world In this world, webpage rendering responsibility was handed over to the client (browser) and server was responsible mostly for business logic and data model. This again has lot of advantage and some disadvantage.

Client side and server side rendering world each has its own benefits and 'Isomorphic JavaScript’ is the way to obtain the best of both the worlds.

And React is a framework to provide isomorphic support out of the box.

like image 43
Avtar Sohi Avatar answered Sep 20 '22 07:09

Avtar Sohi