In programming we tend to hear a lot of really strange words such as isomorphism, etc.
What is Isomorphic?
In general term "iso" means "same" and "morphic" means "form" ie same form that we are studied from our childhood.
Let's discuss with examples below.
This code snippet is isomorphic, the code will run in a
node.js environment and it will also run in the web browser.
Now let's have a look on another example which is not isomorphic.
We will be using fetch api to get some data from external api(NewsAPI).
This code is not isomorphic because the
fetch function is provided by the web browser and results in ReferenceError.
If we want to run on both the client and the server we have to import a third-party library such as
axios. The code something looks like this
This code checks for the window object and determines whether or not it is running on the client or the server and then logs the result.
it's "not a particular technology" it's just sort of like a design pattern. Writing code in this way allows you to be able to do certain unique things such as server side rendering.
Thanks for reading and happy coding!
Top comments (0)