Reuse the rendered component ? #270
Closed
AntonitoMt
started this conversation in
General
Replies: 2 comments 2 replies
-
I'm not sure I really understand the question, unfortunately? Can you give me more an idea what you're trying to do? |
Beta Was this translation helpful? Give feedback.
1 reply
-
The parser should not re-parse if the JSX you are passing it doesn't
change. In terms of returning it as a component, however, no — not really.
…On Thu, Sep 19, 2024 at 11:25 PM AntonitoMt ***@***.***> wrote:
As I said, it may be a confusion I have, plus my English is not very good
:). What I want to know is if I can extract the resulting component as a
JSX (as a function, not text).
Simple example:
const ParsedCompo = () => (
<JsxParser jsx={`
<div><label>Any text</label></div>
`} /> );
Can I extract as JSX (not as text) what is inside braces? :
<div><label>Any text</label></div>
and save it in a variable, say ResultingJSX, to reuse it without having to
do the JsxParsing again?
<ResultingJSX/>
Or let me know if it would be the same as using
<ParsedCompo/>
—
Reply to this email directly, view it on GitHub
<#270 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AC5R27D6XWNNUKFKJQKBQH3ZXO5XHAVCNFSM6AAAAABM7CZ66WVHI2DSMVQWIX3LMV43URDJONRXK43TNFXW4Q3PNVWWK3TUHMYTANZQGA3TINI>
.
You are receiving this because you commented.Message ID:
***@***.***
.com>
--
Troy Alford | ***@***.*** | 818-921-6288
|
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Just a doubt. I know that the result of the parser is a rendered "instance" of the component defined in the JSX, but could I get the component itself as a function? That is, to be able to reuse it without having to do the parsing again? If I'm confused, please clarify.
Beta Was this translation helpful? Give feedback.
All reactions