import React from 'react'; import PropTypes from 'prop-types'; const Text = ({style, text, ...props}, context) => { const finalStyle = { whiteSpace: 'pre-line', ...style, }; return (
{context.i18n ? context.i18n.t(text) : text}
); }; Text.contextTypes = { i18n: PropTypes.shape({ t: PropTypes.func.isRequired, }), }; Text.defaultProps = { style: {}, text: '', }; export default Text;