Skip to content

Commit

Permalink
refactor: remove use of cloning so React is no longer strictly required
Browse files Browse the repository at this point in the history
  • Loading branch information
quantizor committed Dec 4, 2024
1 parent f2f58f0 commit 9d42449
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
5 changes: 5 additions & 0 deletions .changeset/gold-kiwis-peel.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'markdown-to-jsx': patch
---

Factor out unnecessary element cloning.
4 changes: 1 addition & 3 deletions index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1265,9 +1265,7 @@ export function compiler(
(HTML_BLOCK_ELEMENT_R.test(normalizedValue) ||
HTML_SELF_CLOSING_ELEMENT_R.test(normalizedValue))
) {
map[mappedKey] = React.cloneElement(compile(normalizedValue.trim()), {
key: index,
})
map[mappedKey] = compile(normalizedValue.trim())
}
} else if (raw !== 'style') {
map[ATTRIBUTE_TO_JSX_PROP_MAP[raw] || raw] = true
Expand Down

0 comments on commit 9d42449

Please sign in to comment.