Sunday, 12 March 2017

Installing and using React

I have spent a long time simply trying to install React and React-DOM.

I start my script with:

   var React = require('react'); 
   var ReactDOM = require('react-dom');

I used Node and NPM to install into my project directory, and I can see they've been successfully installed in my NetBeans IDE. I open Project Setting->Javascript Libraries->NPM and I can see React v15.4.2 and React-DOM v15.4.2.

Despite this I still get the error:

    ReferenceError: Can't find variable: require 
       (21:07:49:681 | error, javascript)
       at global code (public_html/main.js:8:20)

If anyone has a suggestion then I would really appreciate it.



via Linden

No comments:

Post a Comment