Skip to content

Add Resource Components for Create, Update, Delete #32

@orther

Description

@orther

Overview

We've found it quite convenient to use ResourceLoader components to setup data loading in our containers. It has become clear that providing the other CRUD operations as child render components would be useful. So I'd like to add the following components:

New Components

NOTE: The following examples are not actually thought through so the items passed to the child render prop will likely be much different.

// --
// -- CreateResource
// --
<CreateResource resource="user" entityType="user" needle={123}>
{({create, onEventCreate, status}) => /* ... */}
</CreateResource> 

// --
// -- UpdateResource
// --
<UpdateResource resource="user" entityType="user" needle={123}>
{({update, onEventUpdate, status}) => /* ... */}
</UpdateResource> 

// --
// -- DeleteResource
// --
<DeleteResource resource="user" entityType="user" needle={123}>
{({delete, onEventDelete, status}) => /* ... */}
</DeleteResource> 

Other Possible Solutions

One thing that we could possibly do to provide this functionality is to provide functions for triggering Create, Update, Delete requests of the resource loaded by the ResourceLoader component. I highly doubt that is a good solution and even if it was it could make sense to build it from these new CrUD components.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or requestuptrend project needFeature or fix needed for Uptrend project dependent on URM

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions