ueca-react 1.0.7 → 2.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +109 -119
  3. package/dist/index.d.ts +266 -4
  4. package/dist/ueca-react.js +1453 -0
  5. package/docs/Arrays and Reactivity in UECA-React.md +158 -0
  6. package/docs/Automatic onChange Events in UECA-React.md +142 -0
  7. package/docs/Automatic onChanging Events in UECA-React.md +157 -0
  8. package/docs/Automatic onPropChange and onPropChanging Events in UECA-React.md +112 -0
  9. package/docs/Component Extension in UECA-React.md +275 -0
  10. package/docs/Component IDs in UECA-React.md +181 -0
  11. package/docs/{component-intergation-model.md → Component Integration Model in UECA-React.md } +4 -3
  12. package/docs/{component-mental-model.md → Component Mental Model in UECA-React.md } +4 -3
  13. package/docs/Introduction to UECA-React Components.md +190 -0
  14. package/docs/Introduction to UECA-React.md +24 -0
  15. package/docs/Lifecycle Hooks in UECA-React.md +237 -0
  16. package/docs/Message Bus in UECA-React.md +260 -0
  17. package/docs/Model Caching in UECA-React.md +144 -0
  18. package/docs/Property Bindings in UECA-React.md +191 -0
  19. package/docs/State Management in UECA-React.md +128 -0
  20. package/docs/Technology of UECA-React.md +45 -0
  21. package/docs/Tracing in UECA-React.md +110 -0
  22. package/docs/code-template.md +53 -27
  23. package/docs/index.md +31 -11
  24. package/package.json +68 -72
  25. package/dist/componentModel.d.ts +0 -127
  26. package/dist/componentModel.js +0 -772
  27. package/dist/dynamicContent.d.ts +0 -22
  28. package/dist/dynamicContent.js +0 -80
  29. package/dist/index.js +0 -29
  30. package/dist/messageBus.d.ts +0 -46
  31. package/dist/messageBus.js +0 -141
  32. package/dist/utils.d.ts +0 -8
  33. package/dist/utils.js +0 -52
  34. package/docs/base-concepts.md +0 -192
  35. package/docs/bindings-overview.md +0 -164
  36. package/docs/general-code-structure.md +0 -177
  37. package/docs/introduction.md +0 -56
  38. package/docs/message-bus.md +0 -177
  39. package/docs/technology.md +0 -45
@@ -1,164 +0,0 @@
1
- # Bindings Overview
2
-
3
- Unified Encapsulated Component Architecture (UECA) offers various binding mechanisms to manage state and interactions between components. Understanding these bindings is crucial for building efficient, maintainable, and scalable applications. This tutorial covers all types of bindings available in UECA.
4
-
5
- ## Types of Bindings in UECA
6
-
7
- UECA supports three primary types of bindings:
8
-
9
- 1. **Unidirectional Binding**: Simplifies state management by ensuring the target property reflects the source property.
10
- 2. **Bidirectional Binding**: Synchronizes state between two properties, allowing changes to propagate in both directions.
11
- 3. **Custom Binding**: Provides flexibility to transform values during the binding process.
12
-
13
- ### 1. Unidirectional Binding
14
-
15
- Unidirectional binding ensures that the value of a property in the source component is reflected in the target component. It is particularly useful for simple data flows where the target property should always match the source property.
16
-
17
- #### Example
18
-
19
- ```typescript
20
- // skip...
21
-
22
- // Component structure declaration
23
- type MyComponentStruct = UEC.ComponentStruct<{
24
- props: {
25
- caption: string;
26
- };
27
- children: {
28
- someInput: InputModel;
29
- }
30
- }
31
-
32
- // skip...
33
-
34
- // Custom react hook. Returns component model.
35
- function useMyComponent(params?: MyComponentParams): MyComponentModel {
36
- const struct: MyComponentStruct = {
37
- props: {
38
- // initialization of properties
39
- caption: "",
40
- },
41
-
42
- children: {
43
- // initialization of children
44
- someInput: useInput({
45
- // Unidirectional binding (read-only).
46
- label: () => model.caption,
47
- }),
48
-
49
- // skip...
50
- ```
51
-
52
- In this example, `model.someInput.label` will always have the value of `model.caption`.
53
-
54
- ### 2. Bidirectional Binding
55
-
56
- Bidirectional binding synchronizes state between two properties, allowing changes to propagate in both directions. This is useful when both components need to update each other.
57
-
58
- #### Example
59
-
60
-
61
- ```typescript
62
- // skip...
63
-
64
- // Component structure declaration
65
- type MyComponentStruct = UEC.ComponentStruct<{
66
- props: {
67
- caption: string;
68
- userName: { firstName?: string; lastName?: string };
69
- };
70
- children: {
71
- someInput: InputModel;
72
- }
73
- }
74
-
75
- // skip...
76
-
77
- // Custom react hook. Returns component model.
78
- function useMyComponent(params?: MyComponentParams): MyComponentModel {
79
- const struct: MyComponentStruct = {
80
- props: {
81
- // initialization of properties
82
- caption: "",
83
- userName: {},
84
- },
85
-
86
- children: {
87
- // initialization of children
88
- someInput: useInput({
89
- label: () => model.caption,
90
- // Bidirectional binding (read-write).
91
- value: UEC.bindProp(() => model.userName, "firstName"),
92
- }),
93
-
94
- // skip...
95
- ```
96
- In this example, `model.userName.firstName` and `model.someInput.value` will always be in sync, reflecting changes made to either property.
97
-
98
- ### 3. Custom Binding
99
-
100
- Custom binding provides the flexibility to transform values during the binding process. This is useful for cases where the displayed value and stored value need to be different or require specific formatting.
101
-
102
- #### Example
103
-
104
- In this example, we'll create a form component called `ContactForm` where the user enters their phone number. The phone number will be displayed in a formatted way (e.g., (123) 456-7890), but it will be stored in the model without formatting.
105
-
106
- ```typescript
107
- // skip...
108
-
109
- // Component structure declaration
110
- type MyComponentStruct = UEC.ComponentStruct<{
111
- props: {
112
- phoneNumber: string;
113
- };
114
- children: {
115
- phoneNumberInput: InputModel;
116
- }
117
- }
118
-
119
- // skip...
120
-
121
- // Custom react hook. Returns component model.
122
- function useMyComponent(params?: MyComponentParams): MyComponentModel {
123
- const struct: MyComponentStruct = {
124
- props: {
125
- // initialization of properties
126
- phoneNumber: ""
127
- },
128
-
129
- children: {
130
- // initialization of children
131
- phoneNumberInput: useMyInput({
132
- label: "Phone Number",
133
- // Custom binding
134
- value: UEC.bind(
135
- () => _formatPhoneNumber(model.phoneNumber), // Display formatted phone number
136
- (value) => (model.phoneNumber = value.replace(/\D/g, '')) // Store only digits
137
- ),
138
- }),
139
-
140
- // skip...
141
-
142
- // Private methods
143
- function _formatPhoneNumber(phoneNumber: string): string {
144
- // Remove all non-numeric characters
145
- const cleaned = ('' + phoneNumber).replace(/\D/g, '');
146
- // Match and format phone number
147
- const match = cleaned.match(/^(\d{3})(\d{3})(\d{4})$/);
148
- if (match) {
149
- return `(${match[1]}) ${match[2]}-${match[3]}`;
150
- }
151
- return phoneNumber;
152
- }
153
- }
154
-
155
- // skip...
156
- ```
157
-
158
- **Custom Binding for Phone Number:**
159
- - **Getter Function**: `() => _formatPhoneNumber(model.phoneNumber)` ensures that the phone number is always displayed in a formatted way.
160
- - **Setter Function**: `(value) => (model.phoneNumber = value.replace(/\D/g, ''))` stores the phone number with only digits, removing any non-numeric characters.
161
-
162
- ### Summary
163
-
164
- Understanding and leveraging different types of bindings in UECA can significantly enhance your application's flexibility, maintainability, and overall design. By using unidirectional, bidirectional, and custom bindings appropriately, you can create robust and scalable applications with ease.
@@ -1,177 +0,0 @@
1
- # UECA General Code Structure
2
-
3
- This section will guide you through the general structure of UECA components, explaining each section with simple code examples.
4
-
5
- ## Component Structure
6
-
7
- Each UECA component follows a [structured template](./code-template.md) that includes properties (`props`), events (`events`), children (`children`), methods (`methods`), and messages (`messages`). Let's break down each part of the structure.
8
-
9
- ### Example Component: MyComponent
10
-
11
- ```typescript
12
- import * as React from "react";
13
- import * as UEC from "ueca-react";
14
-
15
- // Component structure declaration
16
- type MyComponentStruct = UEC.ComponentStruct<{
17
- props: {
18
- title: string;
19
- };
20
-
21
- events: {
22
- onAction: () => void;
23
- };
24
-
25
- children: {
26
- childComponent: ChildComponentModel;
27
- };
28
-
29
- methods: {
30
- performAction: () => void;
31
- };
32
- }>;
33
-
34
- type MyComponentParams = UEC.ComponentParams<MyComponentStruct>;
35
- type MyComponentModel = UEC.ComponentModel<MyComponentStruct>;
36
-
37
- function useMyComponent(params?: MyComponentParams): MyComponentModel {
38
- const struct: MyComponentStruct = {
39
- props: {
40
- title: "Default Title",
41
- },
42
-
43
- events: {
44
- onAction: () => {
45
- console.log("Action triggered");
46
- },
47
- },
48
-
49
- children: {
50
- childComponent: useChildComponent(),
51
- },
52
-
53
- methods: {
54
- performAction: () => {
55
- console.log("Action performed");
56
- },
57
- },
58
-
59
- messages: {
60
- "Component.Message": (payload: { data: string }) => {
61
- console.log(`Message received with data: ${payload.data}`);
62
- },
63
- },
64
-
65
- init: () => {
66
- console.log("Component initialized");
67
- },
68
-
69
- mount: () => {
70
- console.log("Component mounted");
71
- },
72
-
73
- unmount: () => {
74
- console.log("Component unmounted");
75
- },
76
-
77
- View: () => (
78
- <div>
79
- <h1>{model.title}</h1>
80
- <button onClick={() => model.performAction()}>
81
- Perform Action
82
- </button>
83
- <model.childComponent.View />
84
- </div>
85
- ),
86
- };
87
-
88
- const model: MyComponentModel = UEC.useComponent(struct, params);
89
- return model;
90
-
91
- // Private methods
92
- }
93
-
94
- const MyComponent = UEC.getFC(useMyComponent);
95
-
96
- export { MyComponentModel, useMyComponent, MyComponent };
97
- ```
98
-
99
- ### Explanation of Each Section
100
-
101
- 1. **Props**:
102
- - Props are the properties of the component, serving as the inputs. They are defined in the `props` section of the `struct`.
103
-
104
- ```typescript
105
- props: {
106
- title: "Default Title",
107
- },
108
- ```
109
-
110
- 2. **Events**:
111
- - Events are custom events that the component can trigger and handle. They are defined in the `events` section.
112
-
113
- ```typescript
114
- events: {
115
- onAction: () => {
116
- console.log("Action triggered");
117
- },
118
- },
119
- ```
120
-
121
- 3. **Children**:
122
- - Children are the child components nested within this component. They are defined in the `children` section.
123
-
124
- ```typescript
125
- children: {
126
- childComponent: useChildComponent(),
127
- },
128
- ```
129
-
130
- 4. **Methods**:
131
- - Methods are the functions that the component can execute. They are defined in the `methods` section.
132
-
133
- ```typescript
134
- methods: {
135
- performAction: () => {
136
- console.log("Action performed");
137
- },
138
- },
139
- ```
140
-
141
- 5. **Lifecycle Hooks**:
142
- - **Init**: Runs once when the component is created.
143
- - **Mount**: Runs when the component mounts to React DOM.
144
- - **Unmount**: Runs when the component unmounts from React DOM.
145
-
146
- ```typescript
147
- init: () => {
148
- console.log("Component initialized");
149
- },
150
-
151
- mount: () => {
152
- console.log("Component mounted");
153
- },
154
-
155
- unmount: () => {
156
- console.log("Component unmounted");
157
- },
158
- ```
159
-
160
- 6. **View**:
161
- - The `View` function defines the JSX that represents the component's UI.
162
-
163
- ```typescript
164
- View: () => (
165
- <div>
166
- <h1>{model.title}</h1>
167
- <button onClick={() => model.performAction()}>
168
- Perform Action
169
- </button>
170
- <model.childComponent.View />
171
- </div>
172
- ),
173
- ```
174
-
175
- ### Conclusion
176
-
177
- This template provides a comprehensive scaffold for creating UECA components. By following this structure, you ensure that your components are modular, maintainable, and adhere to the principles of UECA. Use this guide as a reference for building new components and extending the functionality of your React application.
@@ -1,56 +0,0 @@
1
- # Introduction
2
-
3
- Welcome to the Unified Encapsulated Component Architecture (UECA) tutorial. UECA is a modern framework designed to create scalable, maintainable, and modular web applications. This introduction will cover the base features of UECA, providing you with a comprehensive understanding of its core principles and benefits.
4
-
5
- ## What is UECA?
6
-
7
- UECA stands for Unified Encapsulated Component Architecture. It is a framework that emphasizes encapsulation, modularity, and maintainability in web development. UECA leverages TypeScript and JSX to create robust and type-safe components, with minimal reliance on React-specific features.
8
-
9
- ## Base Features of UECA
10
-
11
- ### TypeScript Integration
12
-
13
- TypeScript is the primary language used in UECA development. It provides static typing, enhancing code quality and maintainability. By using TypeScript, developers can catch errors early and enjoy a more robust development experience.
14
-
15
- ### Minimal React Usage
16
-
17
- UECA uses React's custom hooks for component model instantiation, but other React features (like class components, useState, useEffect) are avoided. This minimal reliance on React simplifies the learning curve for developers new to React while leveraging the power of React's component-based architecture.
18
-
19
- ### Declarative and Modular Code Style
20
-
21
- The UECA code style emphasizes a declarative and modular approach. This approach focuses on consistency, encapsulation, and readability, ensuring that components are maintainable and scalable.
22
-
23
- ### Standard Code Template
24
-
25
- To maintain consistency across different components, UECA encourages using [a standard code template](code-template.md). This ensures a uniform structure across the codebase, making it easier to navigate and understand.
26
-
27
- ### Comprehensive Binding System
28
-
29
- UECA provides a comprehensive binding system with three types of bindings:
30
- 1. **Unidirectional Binding**: Reflects the value of a property without allowing modifications.
31
- 2. **Bidirectional Binding**: Synchronizes state between two properties, allowing changes to propagate in both directions.
32
- 3. **Custom Binding**: Provides flexibility to transform values during the binding process.
33
-
34
- ### View Rules and Patterns
35
-
36
- UECA has specific rules for handling views:
37
- - **View-Type Methods**: Methods returning JSX should end with "View" to become observers of all observable dependencies.
38
- - **View-Type Properties**: Properties storing JSX should end with "View" to avoid rendering issues and potential application crashes.
39
- - **Rendering**: Use `UEC.renderNode(model.someView)` for methods returning `ReactNode` and `<model.someView />` for those returning `JSX.Element`.
40
-
41
- ### Messaging System
42
-
43
- UECA includes a messaging system that allows components to communicate in a decoupled manner. Components can send and receive messages without direct dependencies, promoting a modular architecture.
44
-
45
- ### Lifecycle Management
46
-
47
- UECA components have lifecycle methods (`init`, `mount`, `unmount`) to manage initialization, mounting, and unmounting processes. These methods ensure that resources are appropriately managed throughout the component's lifecycle.
48
-
49
- ### Encapsulation
50
-
51
- Encapsulation is a core principle of UECA. Each component encapsulates its implementation details, exposing only necessary interfaces. This reduces code complexity and enhances maintainability.
52
-
53
- ## Conclusion
54
-
55
- UECA is a powerful framework designed to create maintainable, scalable, and modular web applications. By leveraging TypeScript, minimizing React usage, and following a declarative and modular code style, UECA provides a robust foundation for modern web development. This tutorial will guide you through the core features of UECA, helping you build efficient and maintainable applications.
56
-
@@ -1,177 +0,0 @@
1
- # UECA Message Bus
2
-
3
- In Unified Encapsulated Component Architecture (UECA), the messaging system plays a crucial role in enabling components to communicate in a decoupled manner. This section will provide an overview of the messaging system, including the message type declaration and a simple example of messaging usage.
4
-
5
- ## What is the Messaging System?
6
-
7
- The messaging system in UECA allows components to send and receive messages without direct dependencies. This promotes a modular architecture where components can interact seamlessly, enhancing maintainability and scalability. Components can post messages to the message bus and subscribe to handle specific messages, facilitating communication across different parts of the application.
8
-
9
- ## Message Type Declaration
10
-
11
- To use the messaging system, you first need to declare the message types. This declaration specifies the structure of the messages, including the input parameters and the output data.
12
-
13
- ### Example Message Type Declaration
14
-
15
- ```typescript
16
- // Application Messages: "message-type": { in: <parameter-type>, out: <parameter-type> }
17
- // Properties "in" and "out" describe value type of input and output parameters.
18
- // Both properties "in" and "out" are optional
19
-
20
- type AppMessage = {
21
- "Api.GetWeatherForecast": {
22
- in: { zip_code: string; date: Date };
23
- out: { temperature: number; rainProbability: number };
24
- };
25
- };
26
- ```
27
-
28
- In this example, the `AppMessage` type defines a message `Api.GetWeatherForecast` with input parameters `zip_code` and `date`, and output data `temperature` and `rainProbability`.
29
-
30
- ## Using the Messaging System
31
-
32
- To use the messaging system, follow these steps:
33
-
34
- 1. **Define the Message Types**: Declare the structure of the messages as shown above.
35
- 2. **Subscribe to Messages**: Use the message bus to subscribe to specific messages in the components that need to handle them.
36
- 3. **Post Messages**: Send messages to the bus from components that need to trigger actions in other components.
37
-
38
- ### Example: WeatherForm and WeatherService Components
39
-
40
- Let's walk through a simple example where a `WeatherForm` component sends a message to request weather data, and a `WeatherService` component handles the message and retrieves the data.
41
-
42
- ### WeatherForm Component
43
-
44
- The `WeatherForm` component sends a message to request weather data.
45
-
46
- ```typescript
47
- import * as UEC from "ueca-react";
48
-
49
- type WeatherFormStruct = UEC.ComponentStruct<{
50
- children: {
51
- zipcodeInputModel: MyInputModel;
52
- dateInputModel: MyInputModel;
53
- submitButtonModel: MyButtonModel;
54
- weatherDisplayModel: WeatherDisplayModel;
55
- };
56
- }, AppMessage>;
57
-
58
- type WeatherFormParams = UEC.ComponentParams<WeatherFormStruct, AppMessage>;
59
- type WeatherFormModel = UEC.ComponentModel<WeatherFormStruct, AppMessage>;
60
-
61
- function useWeatherForm(params?: WeatherFormParams): WeatherFormModel {
62
- const struct: WeatherFormStruct = {
63
- children: {
64
- zipcodeInputModel: useMyInput({ placeholder: "Zip Code" }),
65
-
66
- dateInputModel: useMyInput({ placeholder: "Date" }),
67
-
68
- submitButtonModel: useMyButton({
69
- caption: "Submit",
70
- onClick: async () => {
71
- await _handleSubmit();
72
- },
73
- }),
74
-
75
- weatherDisplayModel: useWeatherDisplay(),
76
- },
77
-
78
- View: () => (
79
- <div>
80
- <div>
81
- <label>Zip Code:</label>
82
- <model.zipcodeInputModel.View />
83
- </div>
84
- <div>
85
- <label>Date:</label>
86
- <model.dateInputModel.View />
87
- </div>
88
- <div>
89
- <model.submitButtonModel.View />
90
- </div>
91
- <model.weatherDisplayModel.View />
92
- </div>
93
- ),
94
- };
95
-
96
- const model: WeatherFormModel = UEC.useComponent(struct, params);
97
- return model;
98
-
99
- // Private methods
100
- async function _handleSubmit() {
101
- model.weatherDisplayModel.data = await model.bus.getAsync(
102
- "Api.GetWeatherForecast",
103
- {
104
- zip_code: model.zipcodeInputModel.value,
105
- date: new Date(model.dateInputModel.value),
106
- }
107
- );
108
- }
109
- }
110
-
111
- const WeatherForm = UEC.getFC(useWeatherForm);
112
-
113
- export { WeatherFormModel, useWeatherForm, WeatherForm };
114
- ```
115
-
116
- ### WeatherService Component
117
-
118
- The `WeatherService` component subscribes to the message and handles the data retrieval.
119
-
120
- ```typescript
121
- import * as UEC from "ueca-react";
122
-
123
- // Service Component Structure
124
- type WeatherServiceStruct = UEC.ComponentStruct<{}, AppMessage>;
125
-
126
- type WeatherServiceParams = UEC.ComponentParams<WeatherServiceStruct, AppMessage>;
127
- type WeatherServiceModel = UEC.ComponentModel<WeatherServiceStruct, AppMessage>;
128
-
129
- function useWeatherService(params?: WeatherServiceParams): WeatherServiceModel {
130
- const struct: WeatherServiceStruct = {
131
- messages: {
132
- "Api.GetWeatherForecast": async ({ zip_code, date }) => {
133
- const response = await fetch(`https://api.weather.com/v3/wx/forecast/daily/5day?postalKey=${zip_code}&format=json`);
134
- const data = await response.json();
135
-
136
- return {
137
- temperature: data.temperature,
138
- rainProbability: data.rainProbability,
139
- };
140
- },
141
- }
142
- };
143
-
144
- const model: WeatherServiceModel = UEC.useComponent(struct, params);
145
- return model;
146
- }
147
-
148
- const WeatherService = UEC.getFC(useWeatherService);
149
-
150
- export { WeatherServiceModel, useWeatherService, WeatherService };
151
- ```
152
-
153
- ### Integration in the App
154
-
155
- Integrate the `WeatherForm` and `WeatherService` components in the main application.
156
-
157
- ```typescript
158
- import * as React from "react";
159
- import { WeatherForm } from "./WeatherForm";
160
- import { WeatherService } from "./WeatherService";
161
-
162
- function App() {
163
- return (
164
- <div>
165
- <h1>UECA Messaging System Example</h1>
166
- <WeatherForm />
167
- <WeatherService />
168
- </div>
169
- );
170
- }
171
-
172
- export default App;
173
- ```
174
-
175
- ## Conclusion
176
-
177
- The UECA messaging system facilitates decoupled communication between components, promoting a modular and maintainable architecture. By defining message types, subscribing to messages, and posting messages, you can create a flexible communication system within your UECA application. This overview and example demonstrate the basic usage of the messaging system, enabling you to integrate it into your projects effectively.
@@ -1,45 +0,0 @@
1
- # Technology of UECA
2
-
3
- Unified Encapsulated Component Architecture (UECA) development leverages a blend of modern web technologies to create scalable, maintainable, and modular applications. Below is a summary of the key technologies and coding practices employed in UECA development:
4
-
5
- ## TypeScript
6
-
7
- - **Core Language**: TypeScript is the primary language used for UECA development. It provides static typing, which enhances code quality and maintainability.
8
- - **General Usage**: Most of the UECA code is written in general TypeScript, focusing on type safety and modern JavaScript features.
9
-
10
- ## JSX
11
-
12
- - **User Interface**: JSX is used to describe the UI in a syntax familiar to both JavaScript and HTML, making it easier to build and understand component structures.
13
- - **Integration with TypeScript**: Combined with TypeScript, JSX allows for type-checked components, reducing runtime errors and improving development efficiency.
14
-
15
- ## React
16
-
17
- - **Minimal Usage**: The only React feature utilized in UECA is custom hooks for component model instantiation. This minimizes the reliance on React-specific code and simplifies the learning curve for developers new to React.
18
- - **Custom Hooks**: Custom hooks are used to instantiate and manage the lifecycle of component models, integrating React’s state and effect management seamlessly into UECA.
19
-
20
- ## Coding Techniques
21
- - **Property Bindings**: Synchronizes state between components and their properties automatically, reducing the need for manual updates.
22
- - **Automatic OnChange$Property$ Events**: Automatically triggers events when a property changes, allowing components to react to updates or intercept changes for validation.
23
- - **Component Lifecycle Hooks**:
24
- Manages initialization, mounting, and unmounting of components, ensuring predictable behavior and proper resource management.
25
- - **Interaction via Message Bus**:
26
- Facilitates decoupled communication between components, promoting a modular architecture by allowing components to interact without direct dependencies.
27
-
28
- ## Coding Style
29
-
30
- - **Declarative and Modular Approach**: The UECA code style emphasizes a declarative and modular approach, focusing on consistency, encapsulation, and readability to create maintainable and scalable component-based applications.
31
- - **Utility Classes**: While the procedural approach is preferred, utility classes can be used where appropriate, particularly for reusable functions and routines.
32
-
33
- ## Standard Code Template
34
-
35
- - **Consistency**: To maintain consistency across different components, developers are encouraged to use a [standard code template](/docs/code-template.md) for creating new components. This ensures that all components have a uniform structure, making the codebase easier to navigate and understand.
36
- - **Structural Similarity**: Keeping the code structurally similar from component to component helps in maintaining readability and reducing the cognitive load on developers when switching between different parts of the application.
37
-
38
- ## React and TypeScript
39
-
40
- - **Web Application Foundation**: A typical UECA application is a web application built using React and TypeScript. React provides the component-based architecture, while TypeScript offers strong typing and modern JavaScript features.
41
- - **Ban on Other React Features**: Besides custom hooks, other React features (like class components, useState, useEffect) are banned from the application code to simplify the architecture and make the codebase more approachable for developers with a TypeScript background.
42
-
43
- ## Conclusion
44
-
45
- UECA development emphasizes the use of TypeScript and JSX, with minimal reliance on React-specific features. By focusing on a declarative and modular approach and maintaining structural consistency, UECA aims to create maintainable and scalable web applications that are easy to understand and develop. Developers familiar with TypeScript and JSX can quickly adapt to UECA, even without extensive experience in React.