import { observer } from 'mobx-react';

@observer
class WorldChild extends Component {
  move = (body, x) => {
    Matter.Body.setVelocity(body, { x, y: 0 });
  };

  update = () => {
    const { body } = this.body;
    if (keys.isDown(keys.LEFT)) {
      this.move(body, -5);
    } else if (keys.isDown(keys.RIGHT)) {
      this.move(body, 5);
    }
    store.characterPosition = body.position;
  };
  //...
}

import { observer } from 'mobx-react';

@observer
class WorldChild extends Component {
  move = (body, x) => {
    Matter.Body.setVelocity(body, { x, y: 0 });
  };

  update = () => {
    const { body } = this.body;
    if (keys.isDown(keys.LEFT)) {
      this.move(body, -5);
    } else if (keys.isDown(keys.RIGHT)) {
      this.move(body, 5);
    }
    store.characterPosition = body.position;
  };
  //...
}
