kevzettler/react-regl

Expected subtree parent to be a mounted class component. This error is likely caused by a bug in React. Please file an issue.

clickglue opened this issue · 2 comments

Hi, thanks for your great work. I get the above error message when trying the following:

app.js

import React, { Component } from 'react';
import Regl from 'react-regl';
import Triangle from './triangle.jsx';

class App extends Component {

render() {
    return (
        <div className="App">
            <h1>React Regl example</h1>
            <Regl width={window.innerWidth} height={window.innerHeight} color={[0,0,0,1]}>
                <Triangle color={[0.812, 0.792, 0.098, 1]} positions={[[-0.5, 0], [0, -0.5], [0.25, 1]]} />
            </Regl>
        </div>
    );
}

}

export default App;

and triangle.jsx:
`
import React,{Component} from 'react';
import {Draw} from 'react-regl';

class Triangle extends Component {
render(){
return (
<Draw
vert={`
precision mediump float;
attribute vec2 position;
void main(){
gl_Position=vec4(position,0,1)
}

    `}
        frag={`
        precision mediump float;
        uniform vec4 color;
        void main(){
            gl_FragColor=color;
        }
        `}
        attributes={{
            position:this.props.positions
        }}
        uniforms={{
            color: this.props.color
        }}
        count={3}
        />
    )
}

}

export default Triangle
`

@clickglue I have added some more through examples to the storybook check out:
http://kevzettler.com/react-regl/

and:
https://github.com/kevzettler/react-regl/tree/master/stories

see if you can copy paste any of those to get up and running

Thank you! I'll try with these examples.