Provide an easier way to import component specific scripts
- Dominant language
- C#
- Stars
- 38.4k
- Forks
- 10.9k
- Avg merge
- 2d 10h
- Merged PRs (30d)
- 281
Description
Currently, to load a component specific script (.razor.js) you do something like this:
```csharp
module = await JS.InvokeAsync("import", "./{PATH}/JsCollocation2.razor.js");
```
The `"import"` convention is a bit awkward to remember and you also need specify the script path. Could we make this simpler? Maybe provide an ImportAsync overload? Or maybe a declarative model, like this (suggestion from @DamianEdwards)?:
```csharp
[JsModuleImport]
private IJSObjectReference? Module { get; set; }
```
@MackinnonBuck did some prototyping for component specific styles that work across render modes a while back that might also be worth considering: [MackinnonBuck/blazor-js-components](https://github.com/MackinnonBuck/blazor-js-components)
Contributor guide
Assessment
This issue has not been assessed yet.