Closed modir closed 4 years ago
Perhaps you are not using a component around the RadioGroup? See this example: https://codesandbox.io/s/polythene-for-mithril-radiogroup-x8kwu
There is a component around it:
m(".inputgroup",
m(RadioGroup, {
name: "salutation",
onChange: state => {
vnode.state.checkedValue = state.target.value;
Customer.current.salutation = state.target.value;
},
buttons: [
{
value: "1",
label: "Herr",
},
{
value: "2",
label: "Frau",
},
{
value: "0",
label: "Firma",
}
]
})
),
The whole form around it works if I leave the RadioGroup away. That's why I am surprised.
Updated codesandbox with your code: https://codesandbox.io/s/polythene-for-mithril-radiogroup-issue-91-w8x5e
OK. I found the problem now. Initially I came from https://www.npmjs.com/package/polythene-mithril-radio-group Because of this page I only installed the radio-group package. But this package alone doesn't have all the needed components. Once I imported polythene-mithril all started to work. Maybe it would be good if you extend the documentation on npmjs.com and write there that always the full package is needed.
Additional information: When only using the code mentioned on https://github.com/ArthurClemens/polythene/blob/master/docs/components/mithril/radio-button.md then the radio button icons appear wrong. In other words "polythene-css" is needed as well for a function set-up.
I copy/pasted this code into my project.
Now I get at the line
m(RadioGroup, {
the error message:Error: "The selector must be either a string or a component."
Isn't RadioGroup a component? Or what else I am doing wrong?
FYI: I am using mithril 2.0.4.