kevzettler / react-regl

React Fiber Reconciler Renderer for Regl WebGL
http://kevzettler.com/react-regl/
196 stars 24 forks source link

Unable to reproduce basic example with React 16.6+ #9

Closed hydrosquall closed 5 years ago

hydrosquall commented 5 years ago

Hi,

Thanks for putting together this library. I've been trying to get a basic example running using the minimal "draw a canvas, and shade it" example from the storybook. I was getting the same error as reported in #7 when developing locally in a storybook. Here's the same code sample running in a sandbox.

import React from "react";
import ReactDOM from "react-dom";
import Regl from "react-regl";

class App extends React.Component {
  constructor(props) {
    super(props);
  }

  componentDidCatch(e, info) {
    console.log(e, info);
  }

  render() {
    return <Regl width={500} height={500} color={[0.5, 0.5, 0.5, 1]} />;
  }
}

const rootElement = document.getElementById("root");
ReactDOM.render(<App />, rootElement);

https://codesandbox.io/s/nn4x2nx6ml

An error comes out in the console about having difficulty with accessing the store prop:

**Warning: Failed child context type: Cannot read property 'store' of undefined**

Downgrading to older React 16.1.1 for both react and react-dom fixes the issue. However, that version is missing some features that I want to use in a current project (hooks, etc), so I'd like to try to find a workaround that lets me use the latest react together with this library.

kevzettler commented 5 years ago

Thanks for reporting @hydrosquall . Unfortunately this does break with later react versions haven't had a chance to debug and upgrade.

kevzettler commented 5 years ago

Tried to upgrade and encountered this error https://github.com/facebook/react/issues/15356

kevzettler commented 5 years ago

a new major version 3.0.0 has been pushed with support for latest react and react-reconciler