1
0
Fork 0
mirror of https://github.com/archtechx/alpine-typescript.git synced 2025-12-12 06:44:03 +00:00

clearer sentence

This commit is contained in:
Samuel Štancl 2021-02-27 00:13:54 +01:00 committed by GitHub
parent acc2715d56
commit 4d45b21363
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -76,7 +76,7 @@ component('example', ExampleComponent);
Which will make it accessible using `Alpine.component('example')('foo', 'bar)`.
**Note: It's better to avoid using `Alpine.component('example', ExampleComponent)`** even if it might work in some cases. The reason for this is that `window.Alpine` might not yet be accessible when you're registering components, and if it is, it's possible that it's already evaluated some of the `x-data` attributes. `component()` is guaranteed to work. And of course, you can alias the import if you wish to use a different name.
**Note: You may notice that `Alpine.component()` can also be used to register components. Hoewver, it's better to avoid using it.** The reason for this is that `window.Alpine` might not yet be accessible when you're registering components, and if it is, it's possible that it's already evaluated some of the `x-data` attributes. `component()` is guaranteed to work. And of course, you can alias the import if you wish to use a different name.
To register multiple components, you can use the `registerComponents()` helper.