components.widgets.hocs.withWidgetHandlers.jsx Maven / Gradle / Ivy
The newest version!
import React from 'react'
import PropTypes from 'prop-types'
import { useOnActionMethod } from '../hooks/useOnActionMethod'
export const withWidgetHandlers = (WrappedComponent) => {
const WithHandlers = (props) => {
const { rowClick, datasource } = props
const onRowClickAction = useOnActionMethod(datasource, rowClick)
return (
)
}
WithHandlers.propTypes = {
rowClick: PropTypes.object,
datasource: PropTypes.string,
}
return WithHandlers
}