You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs-site/src/content/docs/api/createComponent.md
+6-7Lines changed: 6 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,16 +1,16 @@
1
1
---
2
-
title: createComponent
2
+
title: defineComponent
3
3
---
4
4
5
5
## Overview
6
6
7
-
The `createComponent` function is used to create a Regor component, which encapsulates a part of your user interface (UI) with its own behavior and template. Components allow you to build complex UIs by composing smaller, reusable units.
7
+
The `defineComponent` function is used to create a Regor component, which encapsulates a part of your user interface (UI) with its own behavior and template. Components allow you to build complex UIs by composing smaller, reusable units.
8
8
9
9
## Usage
10
10
11
11
### Creating a Regor Component
12
12
13
-
To create a Regor component, call the `createComponent` function with the following parameters:
13
+
To create a Regor component, call the `defineComponent` function with the following parameters:
14
14
15
15
-`template` (required): An HTML string or an object specifying the template for rendering the component. It can include the following properties:
16
16
@@ -30,10 +30,10 @@ To create a Regor component, call the `createComponent` function with the follow
30
30
### Example
31
31
32
32
```ts
33
-
import { createComponent, createApp, html } from'regor'
33
+
import { defineComponent, createApp, html } from'regor'
34
34
35
35
// Define a Regor component
36
-
const myComponent =createComponent(
36
+
const myComponent =defineComponent(
37
37
html`<div></div>`, // Define the component content from html string
38
38
{
39
39
context: (head) => ({
@@ -57,7 +57,7 @@ createApp({
57
57
58
58
## Return Value
59
59
60
-
The `createComponent` function returns a component object with the following properties:
60
+
The `defineComponent` function returns a component object with the following properties:
61
61
62
62
-`context`: The Regor context associated with the component. It defines the component's behavior, data, and reactivity.
63
63
@@ -94,4 +94,3 @@ The `createComponent` function returns a component object with the following pro
Copy file name to clipboardExpand all lines: docs-site/src/content/docs/api/onMounted.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -13,9 +13,9 @@ The `onMounted` function allows you to register a callback function that will be
13
13
To register an `onMounted` callback, simply call the `onMounted` function and pass the desired callback function as an argument. The callback will be executed when the app or component is mounted.
Copy file name to clipboardExpand all lines: docs-site/src/content/docs/api/onUnmounted.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -13,9 +13,9 @@ The `onUnmounted` function allows you to register a callback function that will
13
13
To register an `onUnmounted` callback, simply call the `onUnmounted` function and pass the desired callback function as an argument. The callback will be executed when the component or scope is unmounted or cleaned up.
0 commit comments