Hiding/Obfuscating reactjs code of .jsx file type?

987 views Asked by At

So, I've been making some research browsing throught net and checking websites that are in react and I've noticed that at 80% of them I can't reach their react code anyway to check how it is written. Does people hidden it somewhere or somehow? Because I just been putting my at the bottom of body closure and it is very visible and easily accessable.

How can I hide code of react? Or make it hard to find/read? Is it even possible?

1

There are 1 answers

0
Ori Drori On

JSX is not html, and browsers display it. JSX is a DSL that gets compiled to JS by babel. According to React's JSX docs:

Fundamentally, JSX just provides syntactic sugar for the React.createElement(component, props, ...children) function.

So this code:

<MyButton color="blue" shadowSize={2}>
  Click Me
</MyButton>

compiles into:

React.createElement(
  MyButton,
  {color: 'blue', shadowSize: 2},
  'Click Me'
)