repetere/jsonx

Abstract library to accept alternative JXM providers

Swivelgames opened this issue · 2 comments

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.

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

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