import * as React from 'react' ; import PropTypes from 'prop-types' ; import TopToolbar from '../layout/TopToolbar' ; import { ListButton } from '../button' ; import { useCreateContext , useResourceDefinition } from 'ra-core' ; example export const CreateActions = ( { className , ... rest } ) => { const { basePath } = useCreateContext ( rest ) ; const { hasList } = useResourceDefinition ( rest ) ; return ( < TopToolbar className = { className } { ... sanitizeRestProps ( rest ) } > { hasList && < ListButton basePath = { basePath } />} < /TopToolbar>); } ; const sanitizeRestProps = ( { basePath = null , className = null , hasList = null , resource = null , ... rest } ) => rest ; export interface CreateActionsProps { basePath ? : string ; className ? : string ; hasCreate ? : boolean ; hasEdit ? : boolean ; hasList ? : boolean ; hasShow ? : boolean ; resource ? : string ; } CreateActions . propTypes = { basePath : PropTypes . string , className : PropTypes . string , hasCreate : PropTypes . bool , hasEdit : PropTypes . bool , hasShow : PropTypes . bool , hasList : PropTypes . bool , resource : PropTypes . string , } ;