I created an Input web component with Stencil:
...
export class Input {
@Prop({ mutable: true }) value: string;
@Event() changed: EventEmitter<KeyboardEvent>;
private handleChange (e) {
this.value = e.target?.value;
this.changed.emit(e);
}
render() {
return (
<div class="inputContainer">
<input
type="text"
value={this.value}
onInput={this.handleChange}
/>
</div>
)
}
}
Then after trying to use it inside React jsx file, onChanged does not call console.log
...
function App() {
return (
<div className="App">
// does not call console.log
<ui-input onChanged={(e) => console.log(e)}/>
</div>
);
}
As I've read so far it's because React uses the synthetic event instead of Dom events.
Is there any way to use Dom events within JSX element?