Home / Class/ MouseMove Class — react Architecture

MouseMove Class — react Architecture

Architecture documentation for the MouseMove class in mouse-move.js from the react codebase.

Entity Profile

Dependency Diagram

graph TD
  c9c815db_0fa3_cacf_9c47_c98e8a5ee28b["MouseMove"]
  b06995b9_20f4_1e15_2c5f_cd62c995cb8f["mouse-move.js"]
  c9c815db_0fa3_cacf_9c47_c98e8a5ee28b -->|defined in| b06995b9_20f4_1e15_2c5f_cd62c995cb8f
  56ab32e5_5c1c_b0b1_4295_0fefb414d0f6["render()"]
  c9c815db_0fa3_cacf_9c47_c98e8a5ee28b -->|method| 56ab32e5_5c1c_b0b1_4295_0fefb414d0f6

Relationship Graph

Source Code

fixtures/dom/src/components/fixtures/event-pooling/mouse-move.js lines 6–45

class MouseMove extends React.Component {
  state = {
    events: [],
  };

  checkEvent = event => {
    let {events} = this.state;

    if (event.type === 'mousemove' && events.indexOf(event) === -1) {
      this.setState({events: events.concat(event)});
    }
  };

  render() {
    const {events} = this.state;

    return (
      <TestCase title="Mouse Move" description="">
        <TestCase.Steps>
          <li>Mouse over the box below</li>
        </TestCase.Steps>

        <TestCase.ExpectedResult>
          Mousemove should share the same instance of the event between
          dispatches.
        </TestCase.ExpectedResult>

        <HitBox onMouseMove={this.checkEvent} />

        <p>
          Was the event pooled?{' '}
          <b>
            {events.length ? (events.length <= 1 ? 'Yes' : 'No') : 'Unsure'} (
            {events.length} events)
          </b>
        </p>
      </TestCase>
    );
  }
}

Domain

Frequently Asked Questions

What is the MouseMove class?
MouseMove is a class in the react codebase, defined in fixtures/dom/src/components/fixtures/event-pooling/mouse-move.js.
Where is MouseMove defined?
MouseMove is defined in fixtures/dom/src/components/fixtures/event-pooling/mouse-move.js at line 6.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free