Alternate browser+server API
wmertens opened this issue · 4 comments
wmertens commented
Would it be possible to use the loader and svg-baker for something like the below?
<SymbolProvider>
<App/> // Use with e.g. <UseSymbol symbol={symbol}/>
<svg>[...all currently-used symbols]</svg> // Gets added automatically, or maybe with another component
</SymbolProvider>
SymbolProvider
would add context so that every <UseSymbol/>
can register the id as being used.
This way, it also works with server-side rendering, even if multiple render simultaneously. The in-use symbols are all known by the time the svg
with symbols renders.
kisenka commented
Is this something you talking about in this issue JetBrains/svg-sprite-loader#45?
wmertens commented
Right, I forgot about that one. I took a quick look and it seems to me that I need to make a custom runtime that doesn't do anything, and then just use the objects the loader returns?
kisenka commented
Yes, but I don't understand your case entirely, could you describe by code what such runtime should do?
wmertens commented
Everything would be done by React components, so there would be no runtime.
Whenever you use a sprite it would pass that to the wrapping SpriteProvider
which would then maintain the svg with the symbol at the end of the body.
…On Fri, May 12, 2017, 11:53 AM Stas Kurilov ***@***.***> wrote:
Yes, but I don't understand your case entirely, could you describe by code
what such runtime should do?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#1 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AADWlnhmC6lSs7hhwNCplRUuc1UvZ4u9ks5r5CwlgaJpZM4NUVPJ>
.