@eventrixState

This decorator extend component by eventrix state and rerender on eventrix state change.

"eventrixComponent" decorator is required if You want use any of eventrix component decorators

If You want use hooks, hocs or component decorator You must use EventrixProvider in Your application. Go to "EventrixProvider" page in "Context" section for more details.

import React from 'react';
import { eventrixComponent, eventrixState } from 'eventrix';

@eventrixComponent
@eventrixState('clients.list', 'clientsList')
class ClientsListCounter extends React.Component { 
    render() {
        return (
            <div>Clients number: {this.state.clientsList.length}</div>
        );
    }
}

export default ClientsListCounter;

Last updated