reactjs - React-dom.js import statement results in Uncaught ReferenceError: define is not defined. -


i writing test component integration project using typescript , react in visual studio. use tracking down why following code has issue:

define(["require", "exports", 'react', 'react-dom'], function (require, exports, react, reactdom)

on scripts/typings/react-dom/react-dom.d.ts reference path line, error flagged stating: "uncaught referenceerror: define not defined"
line error reported on line 8, col 1 of javascript version shown below:

the typescript component looks this:

///<reference path='../../scripts/typings/react/react.d.ts' /> ///<reference path='../../scripts/typings/react-dom/react-dom.d.ts' />  import react = require('react'); import reactdom = require('react-dom');   interface p { name?: string; }  interface s { complete?: boolean; }   class goal extends react.component<p, s> { state: s = {     complete: false }  private _togglecompletion = () => {     this.setstate({ complete: !this.state.complete }); }  render() {     var status = 'status: ' + (this.state.complete ? 'complete' : 'incomplete');     return react.dom.div({         children: [             react.dom.div({}, this.props.name + ' - ' + status),             react.dom.button({                 onclick: this._togglecompletion             }, 'toggle completion')         ]     }); } }  reactdom.render(react.createelement(goal, { name: 'learn react , typescript' }),     document.getelementbyid('react'));   

the compiled javscript version of file follows:

 /// <reference path='../../scripts/typings/react/react.d.ts' />     /// <reference path='../../scripts/typings/react-dom/react-dom.d.ts' />     var __extends = (this && this.__extends) || function (d, b) {     (var p in b) if (b.hasownproperty(p)) d[p] = b[p];     function __() { this.constructor = d; }     d.prototype = b === null ? object.create(b) : (__.prototype = b.prototype, new __()); }; define(["require", "exports", 'react', 'react-dom'], function (require, exports, react, reactdom) {     var goal = (function (_super) {         __extends(goal, _super);         function goal() {             var _this = this;             _super.apply(this, arguments);             this.state = {                 complete: false             };             this._togglecompletion = function () {                 _this.setstate({ complete: !_this.state.complete });             };         }         goal.prototype.render = function () {             var status = 'status: ' + (this.state.complete ? 'complete' : 'incomplete');             return react.dom.div({                 children: [                     react.dom.div({}, this.props.name + ' - ' + status),                     react.dom.button({                         onclick: this._togglecompletion                     }, 'toggle completion')                 ]             });         };         return goal;     })(react.component);     reactdom.render(react.createelement(goal, { name: 'learn react , typescript' }), document.getelementbyid('react')); }); 


Comments

Popular posts from this blog

Delphi XE2 Indy10 udp client-server interchange using SendBuffer-ReceiveBuffer -

Qt ActiveX WMI QAxBase::dynamicCallHelper: ItemIndex(int): No such property in -

Enable autocomplete or intellisense in Atom editor for PHP -