three.js OBJLoader not loading in react
So it seems that adding this.THREE = THREE
to the react component does the trick (weird, eh?).
So my code currently looks like:
import React from 'react';
import ReactDOM from 'react-dom';
import React3 from 'react-three-renderer';
import TrackballControls from './TrackballControls';
import * as THREE from 'three';
import * as OBJLoader from 'three-obj-loader';
OBJLoader(THREE);
class MyClass extends React.Component {
...
render() {
...
this.THREE = THREE;
const objLoader = new this.THREE.OBJLoader();
}
}