将回调函数传递给 react-admin 资源

问题描述


class Home extends React.Component{

    constructor(props) {
        super(props);
        this.state = {
            showModal : false
        }
    }
    ...

    render() {
        return(
            <div>
            ...

                <Admin theme={myTheme} dataProvider={myDataProvider} layout={MyLayout}>
                    <Resource title="Users" name="users" list={UserList}/>
                </Admin>
            ...

我想通过 UserList 传递一个回调函数,因为 UserList 有一个按钮,当我按下它时,我想显示一些模态。

在我的用户列表中:

export const UserList = (props) => (
    <List {...props}
          pagination={<PostPagination/>}
          actions={<NoneActions/>}
    >

如何将函数传递给Resource-Component? 我想在UserList的props中接收一个回调函数

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)