diff --git a/docs/jsx.md b/docs/jsx.md index be58e3c3..38933927 100644 --- a/docs/jsx.md +++ b/docs/jsx.md @@ -2,8 +2,10 @@ - [Description](#description) - [Setup](#setup) +- [Production build](#production-build) - [Using Babel with Webpack](#using-babel-with-webpack) - [JSX vs hyperscript](#jsx-vs-hyperscript) +- [A note on event listeners](#a-note-on-event-listeners) - [Converting HTML](#converting-html) --- @@ -23,6 +25,7 @@ function MyComponent() { } // can be written as: + function MyComponent() { return { view: () => ( @@ -338,6 +341,24 @@ function SummaryView() { --- +### A note on event listeners + +While JSX events are usually named using camelCase, lowercase names should be used when JSX is used with Mithril. + +```jsx +m("main", [ + m("input", { type: "text", oninput: ... }), + m("input", { type: "button", value: "Click me", onclick: ... }) +]) + +// can be written as: + +
+ + +
+``` + ### Converting HTML In Mithril, well-formed HTML is generally valid JSX. Little more than just pasting raw HTML is required for things to just work. About the only things you'd normally have to do are change unquoted property values like `attr=value` to `attr="value"` and change void elements like `` to ``, this being due to JSX being based on XML and not HTML.