@@ -5,8 +5,8 @@ This section covers core features of IDOM that are used in making
55interactive interfaces.
66
77
8- Pure Elements
9- -------------
8+ Pure Components
9+ ---------------
1010
1111As in most programming paradigms, so many of the problems come down to how we manage
1212state. The first tool in encouraging its proper curation is the usage of
@@ -17,7 +17,7 @@ way to manage state is to have no state at all."
1717With IDOM the core of your application will be built on the back of basic functions and
1818coroutines that return :ref: `VDOM <VDOM Mimetype >` models and which do so without state
1919and without `side effects `_. We call these kinds of model rendering functions
20- :ref: `Pure Elements `. For example, one might want a function which
20+ :ref: `Pure Components `. For example, one might want a function which
2121accepted a list of strings and turned it into a series of paragraph elements:
2222
2323.. code-block ::
@@ -26,12 +26,12 @@ accepted a list of strings and turned it into a series of paragraph elements:
2626 return idom.html.div([idom.html.p(text) for text in list_of_text])
2727
2828
29- Stateful Elements
30- -----------------
29+ Stateful Components
30+ -------------------
3131
32- A Stateful Element is one which uses a :ref: `Life Cycle Hooks `. These life cycle hooks
33- allow you to add state to otherwise stateless functions. To create a stateful element
34- you'll need to apply the :func: `~idom.core.element.element ` decorator to a coroutine _
32+ A Stateful Component is one which uses a :ref: `Life Cycle Hooks `. These life cycle hooks
33+ allow you to add state to otherwise stateless functions. To create a stateful component
34+ you'll need to apply the :func: `~idom.core.component.component ` decorator to a coroutine _
3535whose body contains a hook usage. We'll demonstrate that with a simple
3636:ref: `click counter `:
3737
@@ -40,7 +40,7 @@ whose body contains a hook usage. We'll demonstrate that with a simple
4040 import idom
4141
4242
43- @idom.element
43+ @idom.component
4444 def ClickCount():
4545 count, set_count = idom.hooks.use_state(0)
4646
@@ -50,14 +50,14 @@ whose body contains a hook usage. We'll demonstrate that with a simple
5050 )
5151
5252
53- Element Layout
54- --------------
53+ Component Layout
54+ ----------------
5555
56- Displaying an element requires you to turn elements into :ref: `VDOM <VDOM Mimetype >` -
56+ Displaying components requires you to turn them into :ref: `VDOM <VDOM Mimetype >` -
5757this is done using a :class: `~idom.core.layout.Layout `. Layouts are responsible for
58- rendering elements (turning them into VDOM) and scheduling their re-renders when they
58+ rendering components (turning them into VDOM) and scheduling their re-renders when they
5959:meth: `~idom.core.layout.Layout.update `. To create a layout, you'll need an
60- :class: `~idom.core.element.Element ` instance, which will become its root, and won't
60+ :class: `~idom.core.component.Component ` instance, which will become its root, and won't
6161ever be removed from the model. Then you'll just need to call and await a
6262:meth: `~idom.core.layout.Layout.render ` which will return a :ref: `JSON Patch `:
6363
@@ -80,7 +80,7 @@ have to re-render the layout and see what changed:
8080 event_handler_id = "on-click"
8181
8282
83- @idom.element
83+ @idom.component
8484 def ClickCount():
8585 count, set_count = idom.hooks.use_state(0)
8686
@@ -212,7 +212,7 @@ models:
212212 import idom
213213 from idom.server.sanic import PerClientStateServer
214214
215- @idom.element
215+ @idom.component
216216 def View (self ):
217217 return idom.html.h1([" Hello World" ])
218218
@@ -233,7 +233,7 @@ The implementation registers hooks into the application to serve the model once
233233
234234 app = Sanic()
235235
236- @idom.element
236+ @idom.component
237237 def View (self ):
238238 return idom.html.h1([" Hello World" ])
239239
0 commit comments