<commit_before>import React, { Component } from 'react';

const withHover = (WrappedComponent) => {
  return class HoverableComponent extends Component {
    state = { hover: false, anchorEl: null }

    handleMouseOver = (event) => {
      this.setState({ hover: true, anchorEl: event.currentTarget})
    }

    handleMouseLeave = () => {
      this.setState({ hover: false, anchorEl: null })
    }

    render () {
      const props = { hover: this.state.hover, anchorEl: this.state.anchorEl, ...this.props, stopHover: this.handleMouseLeave }
      return (
        <span onMouseOver={this.handleMouseOver} onMouseLeave={this.handleMouseLeave}>
          <WrappedComponent { ...props } />
        </span>
      )
    }
  }
}

export default withHover<commit_msg>convert withHover to be Hook underneath and add tracking. Will see if it works.<commit_after>import React, { Component } from 'react';
import { hookToHoc } from '../../lib/hocUtils.js';
import { withTracking } from '../../lib/analyticsEvents'

export const HoverOpenContext = React.createContext('hoverOpen')

const HoverManagerComponent = (WrappedComponent) => {
  return class HoverableComponent extends Component {
    state = { hover: false, anchorEl: null }

    handleMouseOver = (event) => {
      this.setState({ hover: true, anchorEl: event.currentTarget})
      this.captureEvent("hoverEventTriggered")
    }

    handleMouseLeave = () => {
      this.setState({ hover: false, anchorEl: null })
    }

    render () {
      const props = { hover: this.state.hover, anchorEl: this.state.anchorEl, ...this.props, stopHover: this.handleMouseLeave }
      return (
          <HoverOpenContext.Provider value={
            <span onMouseOver={this.handleMouseOver} onMouseLeave={this.handleMouseLeave}>
            <WrappedComponent {...props} />
            </span>
          }/>
      )
    }
  }
}

export const HoverManager = withTracking(HoverManagerComponent)
export const useHover = () => React.useContext(HoverOpenContext)
export const withHover = hookToHoc(useHover)
export default withHover
{'fraction_non_alphanumeric': 0.12475822050290135, 'fraction_numerical': 0.0, 'mean_word_length': 3.162977867203219, 'pattern_counts': {'":': 0, '<': 10, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2553449', 'n_tokens_mistral': 596, 'n_tokens_neox': 595, 'n_words': 141}