Make registering a component with a decorator the default.

This commit is contained in:
Emil Stenström 2021-02-27 16:40:16 +01:00
parent b9446c2818
commit c6b20e4cb0

View file

@ -150,7 +150,7 @@ Inside this file we create a Component by inheriting from the Component class an
```python
from django_components import component
@component.register("calendar")
class Calendar(component.Component):
def context(self, date):
return {
@ -163,9 +163,6 @@ class Calendar(component.Component):
class Media:
css = {'all': ['[your app]/components/calendar/calendar.css']}
js = ['[your app]/components/calendar/calendar.js']
component.registry.register(name="calendar", component=Calendar)
```
And voilá!! We've created our first component.