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

Passing handler function as props #24

Closed
sirajulm opened this issue Dec 1, 2017 · 3 comments
Closed

Passing handler function as props #24

sirajulm opened this issue Dec 1, 2017 · 3 comments

Comments

@sirajulm
Copy link

sirajulm commented Dec 1, 2017

@nlaffey @eiof
Does the current implementation support passing handler functions as function names to the schema?

I'm able to work with the below scenario:

{
    component: 'MyComponent,
    onClick: this.handleClickingMe.bind(this),
}

This one is possible if I'm creating using the schema just within the Component.

But it is not working with the below scenario, where I'd like to save and load the schema from the DB. In such cases, it is not possible to put the function reference directly, it would require function names to be saved instead.

{
    component: 'MyComponent,
    onClick: 'handleClickingMe',
}

I'd suggest something like below:

{
    component: 'MyComponent,
    handlers: [
            onClick: 'handleClickingMe',
    ]

}

Would be good if you could throw some insights on this. I'll find time to contribute for the same.

@eiof
Copy link
Collaborator

eiof commented Dec 1, 2017

I think that fits within the mission statement, "Configure and build views using JSON schemas mapped to React components." I'm open to this being supported. If you find time to put together a pull request, we can discuss it more.

@richbai90
Copy link

Just opened a PR for this request

@eiof
Copy link
Collaborator

eiof commented Feb 12, 2020

See #34 (comment)

@eiof eiof closed this as completed Feb 12, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants