A HOC to manage checkboxes state
Or see it on Github Page.
npm install react-checkbox-handling
or
yarn add react-checkbox-handling
1 . Import handleCheckbox
import handleCheckbox from 'react-checkbox-handling';
2 . Pass your component to handleCheckbox
export default handleCheckbox(ComponentName,Configuration(optional))
Option | Type | Default Value | Description |
---|---|---|---|
checkboxKey | string | 'CHECK_KEY' | To provide custom key to check |
isShiftRequired | boolean | false | If shift key support is required or not |
These are all of the available props (and their default values) provided by hoc.
{
checkedItems: [], //Checked values
checkAll: () => void, //To check all the values
uncheckAll: () => void, //To uncheck all the values
updateCheckedItems: (checkedItem : Array<Object> | Array<string> | Object | string , addItems: boolean = false ) => void // To update the checked item array , addItems value will be used when array is passed in checkedItem
updateTotalItems: (totalItems: Array<Object> | Array<string>) => void //To update the total list of items
}
Copy the example folder in your project and run it.