Files
posthog.com/kea.js
Yakko Majuri b59918c8d9 Refactor Plugin Library Logic (#884)
* Refactor Plugin Library Logic

* add kea router

* update types

* add dynamic routing

* upgrade kea

* kea SSR with location for router

* fix random undefined bug

* wip changes

* use selector

* fix build fail

* add netlify config

* fix back button

* don't redirect to root if still loading plugins

* refactor actions and logic

Co-authored-by: Marius Andra <marius.andra@gmail.com>
2021-02-01 10:06:12 +00:00

14 lines
467 B
JavaScript

import React from 'react'
import { Provider } from 'react-redux'
import { getContext, resetContext } from 'kea'
import { loadersPlugin } from 'kea-loaders'
import { routerPlugin } from 'kea-router'
export function initKea(isServer = false, location = '') {
resetContext({
plugins: [loadersPlugin, routerPlugin(isServer ? { location } : {})],
})
}
export const wrapElement = ({ element }) => <Provider store={getContext().store}>{element}</Provider>