1.0.32 • Published 3 years ago

@kth/kth-node-react-common v1.0.32

Weekly downloads
198
License
MIT
Repository
github
Last release
3 years ago

kth-node-react-common alt text

KTH Stockholm has several applications which are based on React and support server-side rendering with Node.js, e.g. some smaller parts of https://www.kth.se. This package contains common utility functions and components used by those applications.

Installation

  • Install the package:

    npm install @kth/kth-node-react-common
  • Install the peer-dependencies of the package:

    npm install axios react prop-types

How to use

  • Option 1: Import parts of the package and destructure them then:

    // Examples (ES6 style):
    import { Utils, Components, FormComponents, MobxUtils } from '@kth/kth-node-react-common'
    
    const { ensureObject } = Utils
    const { Breadcrumbs, SystemMessage } = Components
    const { useDataBag, Input } = FormComponents
    const { useStore } = MobxUtils
    // Examples (CommonJS style):
    const { Utils, Components, FormComponents, MobxUtils } = require('@kth/kth-node-react-common')
    
    const { ensureObject } = Utils
    const { Breadcrumbs, SystemMessage } = Components
    const { useDataBag, Input } = FormComponents
    const { useStore } = MobxUtils
  • Option 2: Import sub-directory of the package and destructure them directly:

    // Examples (ES6 style):
    import { ensureObject } from '@kth/kth-node-react-common/utils'
    import { Breadcrumbs, SystemMessage } from '@kth/kth-node-react-common/components'
    import { useDataBag, Input } from '@kth/kth-node-react-common/FormComponents'
    import { useStore } from '@kth/kth-node-react-common/MobxUtils'
    // Examples (CommonJS style):
    const { ensureObject } = require('@kth/kth-node-react-common/utils')
    const { Breadcrumbs, SystemMessage } = require('@kth/kth-node-react-common/components')
    const { useDataBag, Input } = require('@kth/kth-node-react-common/FormComponents')
    const { useStore } = require('@kth/kth-node-react-common/MobxUtils')
  • Option 3: Import parts of the package, destructure them twice directly:

    This is only possible with CommonJS style imports.

    // Examples (CommonJS style):
    const { ensureObject } = require('@kth/kth-node-react-common').Utils
    const { Breadcrumbs, SystemMessage } = require('@kth/kth-node-react-common').Components
    const { useDataBag, Input } = require('@kth/kth-node-react-common').FormComponents
    const { useStore } = require('@kth/kth-node-react-common').MobxUtils

Package content

The different parts of this package are described in detail in the following Markdown files:

  • MobxUtils
  • Other utilities (tbd.)
  • Helper components (tbd.)
  • FormHelper components (tbd.)
1.0.32

3 years ago

1.0.31

3 years ago

1.0.30

3 years ago

1.0.29

3 years ago

1.0.28

3 years ago

1.0.27

3 years ago

1.0.26

3 years ago

1.0.25

3 years ago

1.0.24

3 years ago

1.0.23

3 years ago

1.0.22

3 years ago

1.0.21

3 years ago

1.0.20

3 years ago

1.0.19

3 years ago

1.0.18

3 years ago

1.0.17

3 years ago

1.0.16

3 years ago

1.0.15

3 years ago

1.0.14

3 years ago

1.0.13

3 years ago

1.0.12

3 years ago

1.0.11

3 years ago

1.0.10

3 years ago

1.0.9

3 years ago

1.0.8

3 years ago

1.0.7

3 years ago

1.0.6

3 years ago

1.0.5

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago