mudgen / webscript

Webscript is a Javascript library for creating DOM elements. Use it to create web applications. It is like HTML but it is Javascript. It is designed to work with existing libraries.

Home Page:https://mudgen.github.io/webscript/docs/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

React component

lazeebee opened this issue · comments

How do you use it to add a react component?

Great question. Please see this example: https://mudgen.github.io/webscript/docs/#react-example

Is this example good enough?

Driving by because I found this lib interesting, but saw an error in the docs: React components should never be called as a function, even if they are implemented as a function.

React components must always be instantiated using createElement so that a new element is created where state and other hooks are associated with a new fiber.

@Lokeh Thanks for stopping by. I'll get it fixed

@Lokeh I fixed the documentation about React components: https://mudgen.github.io/webscript/docs/#use-it-in-react,-vue-and-other-libraries!

I also added a new interesting section about what to do about hyphens in Javascript property names : https://mudgen.github.io/webscript/docs/#hyphens-in-property-names