<commit_before>import React from 'react';
import requireTools from './requireTools';


/**
 * Main rendering function for React
 */
export default (templatePath, props = {}, options = {}, callback = () => {}) => {

  // Ensure .jsx transformation
  if (!require.extensions['.jsx']) {
    const tooling = options.tooling;

    if (options.babel){
      require.extensions['.jsx'] = requireTools.babelCore.bind(null, tooling);
    } else {
      require.extensions['.jsx'] = requireTools.reactTools.bind(null, tooling);
    }
  }

  // Option for nonStatic rendering
  // Usually used if we want to do a static first load
  // but dynamic interation subsequently.
  // i.e. React Server side rendering style
  const isNonStatic = options.nonStatic;

  // Initialize the template as a factory
  // and apply the options into the factory.
  const tempate = require(templatePath);
  const component = React.createElement(tempate, props);

  try {
    let content;

    if (isNonStatic){
      // renderToString (with React ids)
      content = React.renderToString(component);

    } else {
      // renderToStaticMarkup (React ids removed)
      content = React.renderToStaticMarkup(component);
    }

    callback(null, content);

  } catch (err) {
    callback(err);
  }
};


<commit_msg>fix spelling error<commit_after>import React from 'react';
import requireTools from './requireTools';


/**
 * Main rendering function for React
 */
export default (templatePath, props = {}, options = {}, callback = () => {}) => {

  // Ensure .jsx transformation
  if (!require.extensions['.jsx']) {
    const tooling = options.tooling;

    if (options.babel){
      require.extensions['.jsx'] = requireTools.babelCore.bind(null, tooling);
    } else {
      require.extensions['.jsx'] = requireTools.reactTools.bind(null, tooling);
    }
  }

  // Option for nonStatic rendering
  // Usually used if we want to do a static first load
  // but dynamic interation subsequently.
  // i.e. React Server side rendering style
  const isNonStatic = options.nonStatic;

  // Initialize the template as a factory
  // and apply the options into the factory.
  const template = require(templatePath);
  const component = React.createElement(template, props);

  try {
    let content;

    if (isNonStatic){
      // renderToString (with React ids)
      content = React.renderToString(component);

    } else {
      // renderToStaticMarkup (React ids removed)
      content = React.renderToStaticMarkup(component);
    }

    callback(null, content);

  } catch (err) {
    callback(err);
  }
};



{'fraction_non_alphanumeric': 0.12175261729352463, 'fraction_numerical': 0.0, 'mean_word_length': 3.088748019017433, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, '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': '5420699', 'n_tokens_mistral': 740, 'n_tokens_neox': 717, 'n_words': 216}