5

I am toying with react.js. I created a simple-minded app It works on my desktop and on my android tablet, but I get a blank page, nothing else, on my phone, whether in the Android browser or in Firefox.

And yes, I did add the required

React.initializeTouchEvents(true);

Any ideas? Thanks.

Aliaksandr Sushkevich
  • 11,550
  • 7
  • 37
  • 44
user3597163
  • 51
  • 1
  • 2
  • These answers look helpful for a blank screen in React: https://stackoverflow.com/questions/56054235/how-to-fix-the-white-screen-after-build-with-create-react-app – Ryan Apr 14 '20 at 06:08

1 Answers1

1

The <script> tag that includes your JS, main.js, is inside document.body but is also rendering your React component to document.body and overwriting itself. Try rendering to the container you provided and see if that fixes it:

Current:

React.renderComponent(RotationContainer( {data:DATA} ), document.body);

Change to render to #content:

React.renderComponent(
  RotationContainer( {data:DATA} ),
  document.querySelector("#content")
);
Ross Allen
  • 43,772
  • 14
  • 97
  • 95