Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implementing setState #1

Closed
tbranyen opened this issue Oct 11, 2016 · 1 comment
Closed

Implementing setState #1

tbranyen opened this issue Oct 11, 2016 · 1 comment

Comments

@tbranyen
Copy link

Have you considered adding in setState-like functionality?

Maybe something like this:

import { outerHTML } from 'diffhtml';

class StatefulComponent extends Component {
  setState(newState) {
    this.state = Object.assign({}, this.state, newState);

    // Patch the previously rendered node with the new VTree.
    outerHTML(this, this.render());
  }
}
@apaleslimghost
Copy link
Owner

I played around with it at first. For me, StatefulComponent and setAttribute are enough, and I'd suggest some external state container for anything more hardcore.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants