0.8.91 • Published 3 months ago

@stackend/react v0.8.91

Weekly downloads
-
License
SEE LICENSE IN LI...
Repository
github
Last release
3 months ago

About Stackend

Stackend.com is backend, frontend & hosting in a single line of code, or if you prefer - a downloadable NPM package. It contains of hosted, pre-made modules with focus on community driven features that you can add to your new or existing project. To use Stackend you need to create a Stackend account, and a Stack (your cloud based backend, frontend and admin).

Stackend React

This library contains React components for Stackend modules.

NOTE: Right now this library is under development and not ready for general use. The API may change at any time. Use on your own risk.

Installation

npm install --save @stackend/api @stackend/react

Noteworthy Dependencies

Setup

You will need to set up a Redux store and initialize the API with the community you will use:

import { createStore, combineReducers, applyMiddleware, compose } from 'redux';
import thunk from 'redux-thunk';
import { STANDARD_REDUCERS } from '@stackend/api/api/reducers';
import { REDUCERS } from '@stackend/react/reducers';
import { initialize } from '@stackend/api/api/actions';
import { getCurrentCommunity } from '@stackend/api';

// Possibly add your own reducers and middleware here
const reducers = {
  ...STANDARD_REDUCERS,
  ...REDUCERS
};

const store = createStore(combineReducers(reducers), {}, compose(applyMiddleware(thunk)));

await store.dispatch(
  initialize({
    permalink: 'stackend-com' /* Replace with your community permalink */
  })
);

Then you can write your own application using Stackend components: Add LoadingThrobber and ModalThrobber to get feedback when backend requests are made.

import LoadingThrobber from '@stackend/react/throbber/LoadingThrobber';
import ModalThrobber from '@stackend/react/throbber/ModalThrobber';
import Content from '@stackend/react/cms/Content';
import { Content as CmsContent } from '@stackend/api/cms';
import { CmsState } from '@stackend/api/cms/cmsReducer';
import { fetchContent } from '@stackend/api/cms/cmsActions';
import { connect } from 'react-redux';

const MY_CMS_ID = 123;

type Props = {
  content: CmsContent;
};

const mapDispatchToProps = {
  fetchContent
};

function mapStateToProps(state: any) {
  const cms: CmsState = state.cmsContent;
  return {
    content: cms[MY_CMS_ID]
  };
}

class MyApp extends Component<Props> {
  componentDidMount() {
    this.props.fetchContent({ id: MY_CMS_ID });
  }

  render() {
    const { content } = this.props;
    return (
      <div>
        {/* Stackend throbbers used to indicate when the app is loading / saving */}
        <LoadingThrobber />
        <ModalThrobber />

        {/* A stackend component displaying some cms content */}
        <Content content={content} />
      </div>
    );
  }
}

export default connect(mapStateToProps, mapDispatchToProps)(MyApp);
0.8.89

8 months ago

0.8.88

8 months ago

0.8.85

8 months ago

0.8.84

8 months ago

0.8.87

8 months ago

0.8.86

8 months ago

0.8.83

8 months ago

0.8.82

8 months ago

0.8.91

3 months ago

0.8.90

8 months ago

0.8.81

8 months ago

0.8.80

9 months ago

0.8.79

9 months ago

0.8.78

10 months ago

0.8.77

10 months ago

0.8.74

10 months ago

0.8.73

10 months ago

0.8.76

10 months ago

0.8.75

10 months ago

0.8.70

10 months ago

0.8.72

10 months ago

0.8.71

10 months ago

0.8.67

10 months ago

0.8.66

10 months ago

0.8.69

10 months ago

0.8.68

10 months ago

0.8.65

1 year ago

0.8.64

1 year ago

0.8.63

1 year ago

0.8.62

2 years ago

0.8.61

2 years ago

0.8.60

2 years ago

0.8.58

2 years ago

0.8.57

2 years ago

0.8.59

2 years ago

0.8.56

2 years ago

0.8.55

2 years ago

0.8.52

2 years ago

0.8.51

2 years ago

0.8.54

2 years ago

0.8.53

2 years ago

0.8.50

3 years ago

0.8.49

3 years ago

0.8.48

3 years ago

0.8.45

3 years ago

0.8.44

3 years ago

0.8.47

3 years ago

0.8.46

3 years ago

0.8.43

3 years ago

0.8.13

3 years ago

0.8.9

3 years ago

0.8.8

3 years ago

0.8.5

3 years ago

0.8.4

3 years ago

0.8.7

3 years ago

0.8.6

3 years ago

0.8.1

3 years ago

0.8.3

3 years ago

0.8.2

3 years ago

0.8.12

3 years ago

0.8.11

3 years ago

0.8.10

3 years ago

0.8.0

3 years ago

0.7.55

3 years ago

0.7.54

3 years ago

0.7.57

3 years ago

0.7.56

3 years ago

0.7.53

3 years ago

0.7.52

3 years ago

0.7.58

3 years ago

0.7.51

3 years ago

0.7.50

3 years ago

0.7.44

3 years ago

0.7.43

3 years ago

0.7.46

3 years ago

0.7.45

3 years ago

0.7.42

3 years ago

0.7.41

3 years ago

0.7.48

3 years ago

0.7.47

3 years ago

0.7.49

3 years ago

0.7.33

3 years ago

0.7.32

3 years ago

0.7.34

3 years ago

0.7.31

3 years ago

0.7.30

3 years ago

0.7.37

3 years ago

0.7.36

3 years ago

0.7.39

3 years ago

0.7.38

3 years ago

0.7.22

3 years ago

0.7.21

3 years ago

0.7.24

3 years ago

0.7.23

3 years ago

0.7.20

3 years ago

0.7.29

3 years ago

0.7.25

3 years ago

0.7.28

3 years ago

0.7.27

3 years ago

0.7.40

3 years ago

0.7.19

3 years ago

0.7.2

3 years ago

0.7.1

3 years ago

0.7.4

3 years ago

0.7.3

3 years ago

0.7.11

3 years ago

0.7.10

3 years ago

0.7.9

3 years ago

0.7.13

3 years ago

0.7.12

3 years ago

0.7.6

3 years ago

0.7.8

3 years ago

0.7.7

3 years ago

0.7.18

3 years ago

0.7.15

3 years ago

0.7.14

3 years ago

0.7.17

3 years ago

0.7.16

3 years ago

0.7.0

4 years ago

0.6.3

4 years ago

0.6.4

4 years ago

0.6.2

4 years ago

0.6.1

4 years ago

0.6.0

4 years ago

0.5.3

4 years ago

0.5.2

4 years ago

0.5.0

4 years ago

0.5.1

4 years ago

0.4.4

4 years ago

0.4.3

4 years ago

0.4.2

4 years ago

0.4.1

4 years ago

0.3.33

4 years ago

0.3.32

4 years ago

0.3.31

4 years ago

0.3.30

4 years ago

0.3.29

4 years ago

0.3.28

4 years ago

0.3.27

4 years ago

0.3.26

4 years ago

0.3.25

4 years ago

0.3.24

4 years ago

0.3.23

4 years ago

0.3.22

4 years ago

0.3.20

4 years ago

0.3.21

4 years ago

0.3.19

4 years ago

0.3.18

4 years ago

0.3.17

4 years ago

0.3.16

4 years ago

0.3.15

4 years ago

0.3.14

4 years ago

0.3.13

4 years ago

0.3.12

4 years ago

0.3.11

4 years ago

0.3.9

4 years ago

0.3.10

4 years ago

0.3.6

4 years ago

0.3.5

4 years ago

0.3.8

4 years ago

0.3.7

4 years ago

0.3.4

4 years ago

0.3.2

5 years ago

0.3.1

5 years ago

0.3.0

5 years ago

0.2.9

5 years ago

0.2.8

5 years ago

0.2.7

5 years ago

0.2.6

5 years ago

0.2.5

5 years ago

0.2.3

5 years ago

0.2.4

5 years ago

0.2.2

5 years ago

0.2.1

5 years ago

0.2.0

5 years ago

0.1.9

5 years ago

0.1.8

5 years ago

0.1.7

5 years ago

0.1.6

5 years ago

0.1.5

5 years ago

0.1.4

5 years ago

0.1.3

5 years ago

0.1.2

5 years ago

0.1.1

5 years ago

0.1.0

5 years ago