The final code

Now that we have all that fixed, we have a well rendered spinning teapot. While doing the coding, we also fixed a bad piece of programming; the pot speed was hard coded to be 20 or so. This is better if it's a const from a programming maxim, "never embed constants in the body of your program":

import React, {Component } from 'react';import {  Animated,  AppRegistry,  asset,  AmbientLight,  Box,  DirectionalLight,  Div,  Model,  Pano,  Plane,  Text,  Vector,  View,  } from 'react-vr';  class TurningPot extends React.Component {    constructor(props) {      super(props);      this.state = {yRotation: 0};      this.lastUpdate = Date.now();      this.rotate = this.rotate.bind(this);     }    rotate() { //custom function, called when it is time to rotate const now = Date.now(); ...

Get Getting Started with React VR now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.