[
{ pattern: /((\{\{\ *article\:\ *)(\d+)(\ *\}\}))/gm, replacement: <ArticleItem id='$3' /> }
];
body = article.body;
parserRules.map((rule : any) => {
body = body.replace(rule.pattern, rule.replacement);
})
and I want search in the body string and replace that regex pattern with a React component, but the problem is in the view display me [object Object].
why?
Because you can't merge string and React components
Обсуждают сегодня