@useEventrix

This decorator extend class by eventrix and register all of receivers and listeners.

"useEventrix" decorator is required if You want use any of eventrix decorators.

import React from 'react';
import { useEventrix, receiver } from 'eventrix';

@useEventrix
class ClientsService {
    constructor(services) {
        this.axios = services.axios;
    }

    getList() {
        return this.eventrix.getState('clients');
    };
}

export default ClientsService;

useEventrix decorator required eventrix in object of first constructor argument.

import axiosService from './axiosService';
import eventrixInstance from './eventrix';
import ClientsService from './ClientsService';

const clientsService = new ClientsService({
    eventrix: eventrixInstance,
    axios: axiosService
});

Last updated