-1
function checkboxFormatter(
  { onChange, ...props }: CheckboxFormatterProps,
  ref: React.RefObject<HTMLInputElement>
) {
  function handleChange(e: React.ChangeEvent<HTMLInputElement>) {
    onChange(e.target.checked, (e.nativeEvent as MouseEvent).shiftKey);
  }

  return <input type="checkbox" ref={ref} {...props} onChange={handleChange} />;
}

any buddy convert this is JavaScript code

i need hear to use him in js in react

jokie me
  • 9
  • 2

1 Answers1

1

You can write like this

function checkboxFormatter(props, ref) {
  function handleChange(e) {
    props.onChange(e.target.checked, (e.nativeEvent as MouseEvent).shiftKey);
  }

  return <input type="checkbox" ref={ref} {...props} onChange={handleChange}/>;
}
Razvan
  • 11
  • 1