I have a component that looked like this (stripped down version):
const cellEditor = (props, editor_params) => {
return (
<input type={getInputType(editor_params.data_type)} onInput={(e) => props.low = e.target.value} value={props.low ?? ''} />
)
}
that input, needs to show in a couple of different places so I extrapolated it to a component:
const CellInput : Component<{data_type: DataType, value: string}> = (props) => {
const [value, setValue] = createSignal(props.value)
const formattedValue = () => value() ?? ""
createEffect(() => {
console.log('hi')
props.value = value()
})
return (
<input type={getInputType(props.data_type)}
value={formattedValue()}
onInput={(e) => {
e.preventDefault()
console.log('regex',data_regex(props.data_type))
if(e.target.value.match(data_regex(props.data_type))){
setValue(e.target.value)
}
}}
/>
)
when I changed the input in the original component to be CellInput like this:
<CellInput data_type={editor_params.data_type} value={props.low}/>
I get an error dev.js:969 Uncaught TypeError: Cannot set property value of #<Object> which has only a getter
how can I accomplish this?