We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hi, some very reputable JS libraries rely on forwardRef being able to take an optional ref, for instance here: https://react-table.tanstack.com/docs/examples/row-selection
So is it possible to support Option[ReactRef[_]] types?
Option[ReactRef[_]]
The only way I could get this code equivalent in slinky was to hack with a null check:
val component = React.forwardRef(FunctionalComponent( fn = (props: RowSelectorProps, tableRef: /*TODO: needs to be Option Type*/ReactRef[js.Any]) => { val defaultRef = useRef[js.Any](null) // TODO: faking it for now... val resolvedRef = if (tableRef != null) tableRef else defaultRef useEffect( () => { resolvedRef.current.asInstanceOf[js.Dynamic].indeterminate = props.indeterminate }, Seq(resolvedRef, props.indeterminate) ) println(s"checked: ${props.checked}, ind: ${props.indeterminate}, table: ${tableRef}") div( input( `type` := "checkbox", checked := props.checked, onChange := props.onChange, ref := resolvedRef, style := props.style ) ) } ))
The text was updated successfully, but these errors were encountered:
Note to self, this is documented at https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/react/index.d.ts#L543
Sorry, something went wrong.
This is going to be a breaking change, so unfortunately we may have to wait until v0.8.0.
No branches or pull requests
Hi, some very reputable JS libraries rely on forwardRef being able to take an optional ref, for instance here:
https://react-table.tanstack.com/docs/examples/row-selection
So is it possible to support
Option[ReactRef[_]]
types?The only way I could get this code equivalent in slinky was to hack with a null check:
The text was updated successfully, but these errors were encountered: