<commit_before>// @flow
/* globals Class: 0, $PropertyType: 0 */
import React, { Component } from "react";
import Backbone from "backbone";
import { render, unmountComponentAtNode } from "react-dom";

class ReactBackboneWrapper<T: Component<*, *, *>> extends Backbone.View {

  componentClass: Class<T>;
  initialProps: ?$PropertyType<T, 'props'>;

  constructor(componentClass: Class<T>, initialProps?: $PropertyType<T, 'props'> = null) {
    super();
    this.componentClass = componentClass;
    this.initialProps = initialProps;
  }

  render() {
    render(React.createElement(this.componentClass, this.initialProps), this.el);
    return this;
  }

  destroy() {
    unmountComponentAtNode(this.el);
  }
}

export default ReactBackboneWrapper;<commit_msg>add english locale provider for react view<commit_after>// @flow
/* globals Class: 0, $PropertyType: 0 */
import React, { Component } from "react";
import Backbone from "backbone";
import { LocaleProvider } from "antd";
import enUS from "antd/lib/locale-provider/en_US";
import { render, unmountComponentAtNode } from "react-dom";

class ReactBackboneWrapper<T: Component<*, *, *>> extends Backbone.View {

  componentClass: Class<T>;
  initialProps: ?$PropertyType<T, 'props'>;

  constructor(componentClass: Class<T>, initialProps?: $PropertyType<T, 'props'> = null) {
    super();
    this.componentClass = componentClass;
    this.initialProps = initialProps;
  }

  render() {
    render(React.createElement(
      LocaleProvider, { locale: enUS },
      React.createElement(this.componentClass, this.initialProps)
    ), this.el);
    return this;
  }

  destroy() {
    unmountComponentAtNode(this.el);
  }
}

export default ReactBackboneWrapper;
{'fraction_non_alphanumeric': 0.13652275379229872, 'fraction_numerical': 0.002333722287047841, 'mean_word_length': 4.622950819672131, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 15, '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': '3396903', 'n_tokens_mistral': 530, 'n_tokens_neox': 517, 'n_words': 123}