Sensors

Sensors are render pros that track some behavior and re-render on state change.

For example, the below <div> will be re-rendered every time mouse position changes.

<MouseSensor>
  {({posX, posY}) => <div />}
</MouseSensor>

libreact comes with plenty of sensors built-in.

Most sensors have also corresponding HOC and class decorator that provide the same functionality. For example, <NetworkSensor> render prop component has a corresponding withNetowrk() HOC and @withNetwork decorator.

results matching ""

    No results matching ""