How to use the kea.kea function in kea

To help you get started, we’ve selected a few kea examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github zeit / next.js / examples / with-kea / pages / index.js View on Github external
import React from 'react'
import PropTypes from 'prop-types'
import { kea } from 'kea'

const logic = kea({
  path: () => ['kea'],
  actions: () => ({
    increment: amount => ({ amount }),
    decrement: amount => ({ amount }),
  }),
  reducers: ({ actions }) => ({
    counter: [
      0,
      PropTypes.number,
      {
        [actions.increment]: (state, payload) => state + payload.amount,
        [actions.decrement]: (state, payload) => state - payload.amount,
      },
    ],
  }),
  selectors: ({ selectors }) => ({
github mariusandra / insights / packages / insights-core / client / scenes / explorer / graph / controls-left.js View on Github external
import './styles.scss'

import React, { Component } from 'react'
import { kea } from 'kea'
import PropTypes from 'prop-types'

import explorerLogic from '~/scenes/explorer/logic'

export const colors = ['#1f77b4', '#ff7f0e', '#2ca02c', '#d62728', '#9467bd', '#8c564b', '#e377c2', '#7f7f7f', '#bcbd22', '#17becf']

@kea({
  connect: {
    actions: [
      explorerLogic, [
        'setGraphTimeGroup',
        'setGraphControls'
      ]
    ],
    props: [
      explorerLogic, [
        'graphTimeGroup'
      ]
    ]
  },

  actions: () => ({
    showMore: true
github mariusandra / insights / packages / insights-core / client / scenes / explorer / graph / compare-with.js View on Github external
import { kea } from 'kea'
import PropTypes from 'prop-types'

import explorerLogic from '~/scenes/explorer/logic'

export const colors = ['#1f77b4', '#ff7f0e', '#2ca02c', '#d62728', '#9467bd', '#8c564b', '#e377c2', '#7f7f7f', '#bcbd22', '#17becf']

const compareWithForTimeGroup = {
  year: [0, 1, 2, 3, 4],
  quarter: [0, 1, 2, 4],
  month: [0, 1, 3, 6, 12, 24],
  week: [0, 1, 4, 12, 52],
  day: [0, 1, 7, 28, 364, 365]
}

@kea({
  connect: {
    actions: [
      explorerLogic, [
        'setGraphControls'
      ]
    ],
    props: [
      explorerLogic, [
        'graphControls',
        'graphTimeGroup'
      ]
    ]
  },

  actions: () => ({
    showMore: true,

kea

Smart front-end architecture

MIT
Latest version published 4 months ago

Package Health Score

73 / 100
Full package analysis