import * as React from 'react' ; import { ReactElement } from 'react' ; import PropTypes from 'prop-types' ; import { CreateContextProvider , ResourceContextProvider , useCheckMinimumRequiredProps , useCreateController , } from 'ra-core' ; import { CreateProps } from '../types' ; import { CreateView } from './CreateView' ; example export const Create = ( props ) : ReactElement => { useCheckMinimumRequiredProps ( 'Create' , [ 'children' ] , props ) ; const controllerProps = useCreateController ( props ) ; const body = ( < CreateContextProvider value = { controllerProps } > < CreateView { ... props } { ... controllerProps } /> < /CreateContextProvider>); return props . resource ? ( < ResourceContextProvider value = { props . resource } > { body } < /ResourceContextProvider>) : (body); } ; Create . propTypes = { actions : PropTypes . element , aside : PropTypes . element , children : PropTypes . element , classes : PropTypes . object , className : PropTypes . string , hasCreate : PropTypes . bool , hasEdit : PropTypes . bool , hasShow : PropTypes . bool , resource : PropTypes . string , title : PropTypes . node , record : PropTypes . object , hasList : PropTypes . bool , successMessage : PropTypes . string , onSuccess : PropTypes . func , onFailure : PropTypes . func , transform : PropTypes . func , } ; export default Create ;