sveltejs – static properties on components

I have a scenario where I need to provide information to a component class such that downstream instantiations can make use of that info.

For instance:

import { AComponent } from 'AComponent.svelte'
...
AComponent.classInfo = {something: somedata}

And then, the component could access that information as in:

<script>
  let something = AComponent.classInfo.something
</script>

There seemed to be some effort in providing this kind of functionality in V2 (I’m using 3) that was discussed in these issues: Support Component Static Method #480, which resulted in Added setup function which can supply static methods/properties. #572.

However, scanning the current docs reveals no such setup method. So, did this survive from V2 to 3 & if not, is there some way to do this?

72 thoughts on “sveltejs – static properties on components”

  1. hello!,I like your writing very so much! percentage we be in contact extra about your post on AOL? I need a specialist in this house to unravel my problem. Maybe that is you! Having a look forward to peer you. |

    Reply

Leave a Comment