dfilatov / vidom

Library to build UI based on virtual DOM
MIT License
415 stars 16 forks source link

Component: get rid of `onInitialStateRequest` in favour of call `setState` inside `onInit` #272

Closed dfilatov closed 7 years ago

dfilatov commented 7 years ago

Currently:

class MyComponent extends Component {
    onInitialStateRequest() {
        return { a : 1 };
    }

    onInit() {
        ...
    }
}

Proposed:

class MyComponent extends Component {
    onInit() {
        this.setState({ a : 1 });
        ...
    }
}