NEWS: Welcome to my new homepage! <3

feat: Added dyn function - figure - Unnamed repository; edit this file 'description' to name the repository.

figure

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

commit ae669c8f9b17a7e1b7cc975ec599b48ff1c53b74
parent 21e76871507d32553c84e7cabc65a973a4ed72e4
Author: typable <contact@typable.dev>
Date:   Fri,  7 Apr 2023 14:24:58 +0200

feat: Added dyn function

Diffstat:
Mlib.ts | 15++++++++++++++-
1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/lib.ts b/lib.ts @@ -39,6 +39,19 @@ export default function figure({ createElement }: Options) { } /** + * Creates a dynamic component with its own state. + * Should be used if the component is statefull (contains hooks). + * + * @param {ReactFunction} element - The string containing references + * @param {Props} props - The component properties + * @param {ReactElement[]} children - The child elements + * @return {ReactElement} The created React component + */ + function dyn(element: ReactFunction, props?: Props, children?: ReactElement[]): ReactElement { + return createElement(element, props, children); + } + + /** * Joins the template literal slices together and replaces the values with references. * The values are being mapped to there corresponding references and with the populated * HTML string returned. @@ -178,5 +191,5 @@ export default function figure({ createElement }: Options) { return [createElement(component ?? tag, props, ...children)]; } - return { dict }; + return { dict, dyn }; }