<commit_before>import Rx from 'rx';
import React from 'react';

import { StreamWrapper } from './streamWrapper.js';
import { makeStreamState, streamWithEffects, identity } from './core.js';


export class TanokInReact extends React.Component {
  constructor(props) {
    super(props);
    const {
       initialState, update, view,
       stateSerializer = identity, middlewares = [],
       onNewState, outerEventStream
    } = props;
    this.stateSerializer = stateSerializer;

    const eventStream = new Rx.Subject();
    const streamWrapper = new StreamWrapper(eventStream, null);
    streamWrapper.metadata.push(null);

    const streamState = makeStreamState(
      Object.assign({}, initialState),
      update,
      eventStream,
      middlewares
    );

    const renderedStream = streamState.do(
      ({state}) => {
        this._mounted && this.setState({state});
        onNewState && onNewState(state);
      }<commit_msg>store initialState as passed without copy (#25)<commit_after>import Rx from 'rx';
import React from 'react';

import { StreamWrapper } from './streamWrapper.js';
import { makeStreamState, streamWithEffects, identity } from './core.js';


export class TanokInReact extends React.Component {
  constructor(props) {
    super(props);
    const {
       initialState, update, view,
       stateSerializer = identity, middlewares = [],
       onNewState, outerEventStream
    } = props;
    this.stateSerializer = stateSerializer;

    const eventStream = new Rx.Subject();
    const streamWrapper = new StreamWrapper(eventStream, null);
    streamWrapper.metadata.push(null);

    const streamState = makeStreamState(
      initialState,
      update,
      eventStream,
      middlewares
    );

    const renderedStream = streamState.do(
      ({state}) => {
        this._mounted && this.setState({state});
        onNewState && onNewState(state);
      }
{'fraction_non_alphanumeric': 0.10935023771790808, 'fraction_numerical': 0.0010565240359218173, 'mean_word_length': 3.237136465324385, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '4077622', 'n_tokens_mistral': 519, 'n_tokens_neox': 504, 'n_words': 131}