Skip to content

ripeworks/antd-crud-resource

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

antd-crud-resource

CRUD data models using built-in components from antd

Example

import React from 'react'
import Resource from 'antd-crud-resource'
import UserForm from './UserForm' // This is an antd form

export default class UserResource extends React.Component {
  onSave = (values, id) => {
    // api.update(id, values)
  }

  onRemove = (user) => {
    // api.delete(user.id)
  }

  render () {
    const {data} = this.props

    return <Resource
      name='User'
      data={data}
      fields={[
        {title: 'Email', dataIndex: 'email'},
        {title: 'Name', dataIndex: 'name'},
        {title: 'Active', dataIndex: 'active', render: v => v ? 'Yes' : 'No'}
      ]}
      form={UserForm}
      onSave={this.onSave}
      onRemove={this.onRemove}
    />
  }
}

About

CRUD data models using built-in components from antd

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published