Marius Andra
Aug 9, 2017 · 1 min read

Hey, thanks! :)

The chapter on connected logic talks about it a bit. However to convert this gist to something others can use, I’d just replace line 5 (“@kea({”) with “export const logic = kea({“ and then add “@logic” before the line “export default class Counter extends Component”.

Then other components can import this logic with just “import { logic } from ‘./original-component’” and use the “@connect” helper to get actions and props from it.

However personally in this case I’d separate the entire logic into a new file and have both components “@connect” to it. Again, the chapter on connected logic goes more in depth on it.

Cheers!

    Marius Andra

    Written by

    Web developer and entrepreneur from Estonia, living in Belgium. Co-founder of apprentus.com