Skip to content

Refactor state-less-components.md to use working code and commentary#14

Open
brotherbill wants to merge 2 commits intoadospace:mainfrom
brotherbill:stateless-components
Open

Refactor state-less-components.md to use working code and commentary#14
brotherbill wants to merge 2 commits intoadospace:mainfrom
brotherbill:stateless-components

Conversation

@brotherbill
Copy link
Contributor

Working code is ideal for learning. This has extensive commentary for user to play well with code generator.

This app will be focused on teaching, so is quite incomplete.
For example, no exception handling, no reading of the user name or password entered. Several useless buttons.

1. Install MauiReactor templates to Visual Studio 2022 *(if not already installed)*
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should try not to focus only on Visual Studio 2022 and Windows, the same template can be adopted on other IDEs and platforms

@brotherbill
Copy link
Contributor Author

brotherbill commented Jan 14, 2025 via email

- **Never** name your `_variable` as a Component name, such as `[Prop] string _label;`
Doing so will break the project with an infinite loop, never seeing your page render.
- The component `class` must be `partial` and inherit from `Component`.
- The `[Prop]` name must start with underscore and be `_camelCase`.
Copy link
Owner

@adospace adospace Jan 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not required to have the field starting with an underscore

- The `[Prop]` name must start with underscore and be `_camelCase`.
- Within the Component, use `_labelText` throughout as the example does.
- Each property that will be passed in has the `[Prop]` attribute.
- Each `[Prop]` should skip the access part such as `public`/`protected`/`internal`/`private`, which will be ignored by the MauiReactor code generator.
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not ignored but preserved, for example, it's perfectly valid to create a prop protected if you want to access it from a derived component class

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants