4

I decided to give a shot at just using React only for server side rendering of my components written in JSX.

I decided to eliminate React on the client side as there is not much client side interaction and I thought of adding it later only if needed.

I have couple of questions on this approach though:

  • How to use plain simple vanilla JavaScript at the client side? I'm still using JSX for my components. Any simple example, like handling a button click via event listener?

  • Bringing the entire hot module replacement experience with this approach. Right now i am using webpack --watch and then restarting node server on any files changes as also stated in this comment. Also, where it's just pure SSR, how to refresh the screen? Right now I don't have to restart my server, but I have to still refresh my screen to reflect my changes.

Has anyone been successfully able to use webpack-hot-middleware in this approach, where it's just pure SSR?

user7637745
  • 965
  • 2
  • 14
  • 27
Ranjith Nair
  • 475
  • 1
  • 6
  • 17
  • 1
    For your first question, it's basically how you would add JavaScript to any static HTML rendered on the server-side, be it rendered with a PHP framework or React. Once the HTML is on the client, it doesn't really matter where it came from. – John Weisz Jun 30 '18 at 20:24

0 Answers0