1.0.25 • Published 5 years ago

ground-aws-graphql-core v1.0.25

Weekly downloads
-
License
ISC
Repository
-
Last release
5 years ago
npm install ground-aws-graphql-core

Step 1 - Import Ground Store Provider

import { GroundGraphqlProvider } from 'ground-aws-graphql-core';

Step 2 - Wrap your application

function App() {
  return (
    <GroundGraphqlProvider aws={awsmobile} mode={process.env.NODE_ENV}>
		  <AttributeList />
	  </GroundGraphqlProvider>
  );
}

Step 3 - Use the context store

import { GroundGraphqlContextStore } from 'ground-aws-graphql-core'

function AttributeList() {
  // attributes in state
  const attributes = GroundGraphqlContextStore.useStoreState(state => state.attribute.attributes)
  
  	// list attributes action
	const listAttributes = GroundGraphqlContextStore.useStoreActions(actions => actions.attribute.listAttributes)

	// create attribute action
  const createAttribute = GroundGraphqlContextStore.useStoreActions(actions => actions.attribute.createAttribute)
  
  return (
    <div>
      {attributes.map((attribute, index) => <div key={index}>{attribute}</div>)}
      <FetchAttributes onFetch={listAttributes} />
      <AddAttribute onAdd={addAttribute} />
    </div>
  )
}

Introduction

Ground AWS Graphql Core provides you the store provider and manage from you the state for your Ground React application using easy-peasy package.

Documentation

1.0.25

5 years ago

1.0.24

5 years ago

1.0.23

5 years ago

1.0.22

5 years ago

1.0.21

5 years ago

1.0.20

5 years ago

1.0.18

5 years ago

1.0.17

5 years ago

1.0.16

5 years ago

1.0.15

5 years ago

1.0.13

5 years ago

1.0.12

5 years ago

1.0.11

5 years ago

1.0.10

5 years ago

1.0.9

5 years ago

1.0.8

5 years ago

1.0.7

5 years ago

1.0.6

5 years ago

1.0.5

5 years ago

1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago