Skip to content

Add optional onChange callback #16

@dmytrotkk

Description

@dmytrotkk

It would be nice to have something like that for words change action:

textChange(textLoopState){
    // do something...
 }

<TextLoop onChange={textChange}>
    {wordsObj}
</TextLoop>

My proposal:

// TextLoop.jsx
 tick = () => {
        this.setState((state, props) => {
+            if(this.props.onChange){
+              this.props.onChange(state);
+            }

             ...

        });
 };

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions