Is it possible to hide React component source code through Node.js backend?

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP



Is it possible to hide React component source code through Node.js backend?



I want to hide my react source code if possible from my users.



I might be completely wrong about this, but I think I remember reading something about how node js can render components server side, then send those rendered components to the front end.



Is it possible to hide my react component source code by using this method? Or is there any way for node js to hide my react source code?



If there is any other method of hiding react source code, I would appreciate any advice.



Thanks





Make an api call to node and hide on its response basis
– Black Mamba
Aug 8 at 13:58





I believe you are referring to React's Server-side Rendering. I believe you're better off just googling about it to get going.
– Chris
Aug 8 at 13:58






Why are you concerned about trying to hide your react code in the first place? Chances are that if there's content you need to hide it shouldn't be anywhere near your front end in the first place.
– Adam
Aug 8 at 14:00





It will make my product harder to reverse engineer from a gui aspect
– Philip Nguyen
Aug 8 at 14:17





Is it possible to hide my react component source code by using this method? - there's nothing to hide, this is server side code which isn't exposed to client side. It's unclear what's your case and whether it's possible to render whole app to static html without loss of functionality.
– estus
Aug 8 at 17:22




1 Answer
1



https://reactjs.org/docs/react-dom-server.html



So React DOM Server can render static markup. It will literally render just HTML, so don't expect any click events or anything.



So your server can start like this:




import express from 'express';
import React from 'react';
import renderToString from 'react-dom/server';
import RootOfYourApp from './src/RootOfYourApp';

const port = 3000;
const server = express();

server.get('/somePath', (req, res) =>
const body = renderToString(<RootOfYourApp />);

res.send(body);
);

server.listen(port);





Sorry, I'll add more content on how to set it up
– SoluableNonagon
Aug 8 at 14:00






By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

Firebase Auth - with Email and Password - Check user already registered

Dynamically update html content plain JS

Creating a leaderboard in HTML/JS