iamdustan / react-hardware

A React renderer for Hardware.
http://iamdustan.com/react-hardware
801 stars 41 forks source link

POC: <board /> component #10

Open iamdustan opened 8 years ago

iamdustan commented 8 years ago

Or really support for any component that has an async mounting period before it can render it’s children. I have no idea how this will impact the codebase, but I imagine it will be slightly invasive.

React’s future incremental reconciler could be really interesting for this.

Strawman API that would be supported by this:

const App = (
  <container>
    <board port="/dev/cu.usbmodem1451" pinMapping={arduinoUnoPinMapping}>
      <Led pin={2} value={this.state.value}
    </board>
    <board port="/dev/cu.usbmodem1455" pinMapping={raspberryPiPinMapping}>{...}</board>
    <board port="/dev/rfcomm0">{someComponentsOnABluetoothConnectedDevice}</board>
  </container>
);

Use case is that full board configurations now become composable without needing an outside state management system other than setState.