<commit_before>import React, { Component, PropTypes } from 'react';
import configureUrlQuery from '../configureUrlQuery';

/**
 * This class exists to read in the router from context (useful in react-router v4)
 * to get an equivalent history object so we can push and replace the URL.
 */
export default class RouterToUrlQuery extends Component {
  static propTypes = {
    children: PropTypes.node,
  }

  static contextTypes = {
    router: PropTypes.object,
  }

  componentWillMount() {
    const { router } = this.context;
    configureUrlQuery({
      history: {
        push: router.transitionTo,
        replace: router.replaceWith,
      },
    });
  }

  render() {
    const { children } = this.props;

    return React.Children.only(children);
  }
}
<commit_msg>Look for replace and push functions first when linking router<commit_after>import React, { Component, PropTypes } from 'react';
import configureUrlQuery from '../configureUrlQuery';

/**
 * This class exists to read in the router from context (useful in react-router v4)
 * to get an equivalent history object so we can push and replace the URL.
 */
export default class RouterToUrlQuery extends Component {
  static propTypes = {
    children: PropTypes.node,
  }

  static contextTypes = {
    router: PropTypes.object,
  }

  componentWillMount() {
    const { router } = this.context;

    configureUrlQuery({
      history: {
        push: router.push || router.transitionTo,
        replace: router.replace || router.replaceWith,
      },
    });
  }

  render() {
    const { children } = this.props;

    return React.Children.only(children);
  }
}

{'fraction_non_alphanumeric': 0.10049019607843138, 'fraction_numerical': 0.0012254901960784314, 'mean_word_length': 3.1133501259445846, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '6693429', 'n_tokens_mistral': 452, 'n_tokens_neox': 447, 'n_words': 147}