Skip to content
This repository has been archived by the owner on Aug 22, 2023. It is now read-only.
/ react-eventmanager Public archive

[Deprecated] Event-based simple React state management with decorators

License

Notifications You must be signed in to change notification settings

eser/react-eventmanager

Repository files navigation

npm version npm download dependencies license

Update

This project became redundant when React Hooks is introduced. So it's deprecated in favor of React's newer versions.

What is the React-EventManager?

React-EventManager is an alternative method of handling states on React views.

Quick start

Execute npm install react-eventmanager to install react-eventmanager and its dependencies into your project directory.

Usage

To handle events in React view:

import * as React from 'react';
import eventManager from 'react-eventmanager';

@eventManager.subscription({
    userChanged: 'onUserChanged'
})
class SampleContainer extends React.Component {
    constructor() {
        super();

        this.state = {
            userName: 'User-1'
        };
    }

    onUserChanged(userName) {
        this.setState({
            userName: userName
        });
    }

    render() {
        return (
            <div>
                {this.state.userName}
            </div>
        );
    }
}

To invoke a change:

import eventManager from 'react-eventmanager';

eventManager.emit('userChanged', 'Eser Ozvataf');

Todo List

See GitHub Projects for more.

Requirements

License

Apache 2.0, for further details, please see LICENSE file

Contributing

See contributors.md

It is publicly open for any contribution. Bugfixes, new features and extra modules are welcome.

  • To contribute to code: Fork the repo, push your changes to your fork, and submit a pull request.
  • To report a bug: If something does not work, please report it using GitHub Issues.

To Support

Visit my patreon profile at patreon.com/eserozvataf

About

[Deprecated] Event-based simple React state management with decorators

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published