In react, if there is a match, but a null handler, then return
null(which is how to delete elements).
Showing
1 changed file
with
1 additions
and
1 deletions
... | @@ -57,7 +57,7 @@ export const Match = (props) => { | ... | @@ -57,7 +57,7 @@ export const Match = (props) => { |
57 | const nextDebug = debug ? debug - 1 : 0 | 57 | const nextDebug = debug ? debug - 1 : 0 |
58 | for (const [ matcher, Handler ] of replacers) { | 58 | for (const [ matcher, Handler ] of replacers) { |
59 | if (matcher(node, parent, index, false)) { | 59 | if (matcher(node, parent, index, false)) { |
60 | return Handler({ debug: nextDebug, parent, node, index, replacers }) | 60 | return Handler ? Handler({ debug: nextDebug, parent, node, index, replacers }) : null |
61 | } | 61 | } |
62 | } | 62 | } |
63 | if (debug) console.log('Match:nothing', {node}) | 63 | if (debug) console.log('Match:nothing', {node}) | ... | ... |
-
Please register or sign in to post a comment