1. Summary
Create a simple, working example of a "Beginner Mode" functional component using Neo.functional.defineComponent and Neo.functional.useConfig.
2. Rationale
This PoC is crucial to validate the end-to-end developer experience for the simplified functional component definition. It will demonstrate that a developer can define a reactive component as a plain function, leveraging hooks for state, and that it renders correctly and updates reactively.
3. Scope & Implementation Plan
- Create a Simple Component: Define a basic functional component (e.g., a counter or a text display) using the
defineComponent factory and useConfig hook.
- Render the Component: Instantiate and render this component within a test environment or a minimal application.
- Verify Reactivity: Ensure that changes to the state managed by
useConfig correctly trigger re-renders of the component.
4. Example Usage
import { defineComponent } from 'neo/functional/defineComponent.mjs';
import { useConfig } from 'neo/functional/useConfig.mjs';
export default defineComponent(function MyCounter(config) {
const [count, setCount] = useConfig(0);
return {
tag: 'button',
text: `Count: ${count}`,
};
});
1. Summary
Create a simple, working example of a "Beginner Mode" functional component using
Neo.functional.defineComponentandNeo.functional.useConfig.2. Rationale
This PoC is crucial to validate the end-to-end developer experience for the simplified functional component definition. It will demonstrate that a developer can define a reactive component as a plain function, leveraging hooks for state, and that it renders correctly and updates reactively.
3. Scope & Implementation Plan
defineComponentfactory anduseConfighook.useConfigcorrectly trigger re-renders of the component.4. Example Usage
// In a component file (e.g., MyCounter.mjs) import { defineComponent } from 'neo/functional/defineComponent.mjs'; import { useConfig } from 'neo/functional/useConfig.mjs'; export default defineComponent(function MyCounter(config) { // The functional component is now the function itself const [count, setCount] = useConfig(0); return { tag: 'button', text: `Count: ${count}`, // No listeners property directly in VDOM for beginner mode }; }); // In your app's MainView or a test file // Neo.create(MyCounter, { id: 'my-counter-instance' });