Recently diving into TypeScript, I've begun working with DetailsList
in Fluent UI. Check it out here: https://developer.microsoft.com/en-us/fluentui#/controls/web/detailslist.
I'm exploring the onRenderRow
property, which is of type IRenderFunction
. More details can be found at: https://github.com/microsoft/fluentui/blob/master/packages/utilities/src/IRenderFunction.ts
In this context, I grasp that props
is a generic type P
, and defaultRender
is a function that takes props
as an argument and returns either JSX.Element
or null
. But why are there parentheses around both? Is it indicative of a function type structure? How should one go about implementing this interface?
(props?: P, defaultRender?: (props?: P) => JSX.Element | null)
Overall, this setup too yields a return type of JSX.Element
or null
.