Where is the JSXTransformer.js after Bower Install?
Asked Answered
D

2

9

In order to use react, I need to have the following in my html file

<script src="http://fb.me/react-0.12.2.min.js"></script>
<script src="http://fb.me/JSXTransformer-0.12.2.js"></script>

I want to user local bower components instead of these links. So I installed react using bower install react

However, when I go into the react directory in my bower components, I do not see a 'JSXTransformer.js' file.

Where is this file? Why was it not installed via bower?

Donelson answered 8/11, 2015 at 3:48 Comment(0)
D
11

It appears that JSXTransformer has been deprecated. The official article suggests using 'babel' instead.

https://facebook.github.io/react/blog/2015/06/12/deprecating-jstransform-and-react-tools.html

Donelson answered 8/11, 2015 at 4:11 Comment(3)
*deprecated, not depreciated :)Prudi
Yes this is true.Elonore
@NicolasConnault What's stopping you from fixing it instead of pointing at it? :)Wardmote
W
0

You can still use react from a HTML page directly.
See official React docs https://legacy.reactjs.org/docs/add-react-to-a-website.html
or tl;dr https://www.w3schools.com/react/react_getstarted.asp

<!DOCTYPE html>
<html>
  <head>
    <script src="https://unpkg.com/react@18/umd/react.development.js" crossorigin></script>
    <script src="https://unpkg.com/react-dom@18/umd/react-dom.development.js" crossorigin></script>
    <script src="https://unpkg.com/@babel/standalone/babel.min.js"></script>
  </head>
  <body>

    <div id="mydiv"></div>

    <script type="text/babel">
      function Hello() {
        return <h1>Hello World!</h1>;
      }

      const container = document.getElementById('mydiv');
      const root = ReactDOM.createRoot(container);
      root.render(<Hello />)
    </script>

  </body>
</html>

If you don't want to use the CDN, just download the three files and include them with your html page.

Wardmote answered 10/5, 2023 at 15:43 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.