2
0
mirror of https://github.com/tenrok/BBob.git synced 2026-06-02 16:04:04 +03:00

feat(react): allow pass custom options to react component

This commit is contained in:
Nikolay Kostyurin
2018-10-25 16:39:49 +02:00
parent 6d37793001
commit 77b30f3d44
3 changed files with 10 additions and 8 deletions
+4 -3
View File
@@ -2,11 +2,11 @@ import React from 'react';
import PropTypes from 'prop-types';
import { render } from './render';
const content = (children, plugins) => React.Children.map(children, child =>
(typeof child === 'string' ? render(child, plugins) : child));
const content = (children, plugins, options) => React.Children.map(children, child =>
(typeof child === 'string' ? render(child, plugins, options) : child));
const Component = props =>
React.createElement(props.container, {}, content(props.children, props.plugins));
React.createElement(props.container, {}, content(props.children, props.plugins, props.options));
if (process.env.NODE_ENV !== 'production') {
Component.propTypes = {
@@ -19,6 +19,7 @@ if (process.env.NODE_ENV !== 'production') {
Component.defaultProps = {
container: 'span',
plugins: [],
options: {},
};
export default Component;