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

Abstract library to accept alternative JXM providers #671

Open
Swivelgames opened this issue Apr 30, 2022 · 2 comments
Open

Abstract library to accept alternative JXM providers #671

Swivelgames opened this issue Apr 30, 2022 · 2 comments

Comments

@Swivelgames
Copy link

It's not a major change, but certainly a major paradigm pivot. It would be awesome to pivot this library from being strictly React specific, and allow the user to specify a JXM renderer themselves.

i.e., instead of using React.createElement, it would be cool if I could pass a function to JSONX that would be invoked whenever an element is created.

The implementation might look like simply abstracting all React.createElement calls to a jxmProvider(type, props, children), and probably making (...args) => React.createElement(...args) the default provider or something.

I put together something very similar to this utility for React, and this is a feature I was planning on adding, but I think it makes a lot of sense to go with something that already exists.

@yawetse
Copy link
Member

yawetse commented May 13, 2022

that would be very cool, I'd love to see a proof of concept PR if you get the chance to tinker with it

@yawetse
Copy link
Member

yawetse commented Jun 24, 2022

@Swivelgames Do you have an example of an alternative jxmProvider? I think it's a pretty doable

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