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:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user