Neat project! I wanted to leave some feedback for the author.
If you just want an interface for building up an AST using composition, you can do this without React. You can even continue to use JSX—it's as simple as having a function definition to create AST primitives and have a JSX pragma that calls into it.
What React is excellent at is taking two trees and finding a set of mutations to transform the nodes from the first tree to the second—with utter disregard to how those trees came to be. That's what the renderer provides—the set of operations that can be performed on nodes.
I don't see how the actual React part can be used here. Even the suggested uses are all single-pass operations where this diffing will never come into play.
That said, to me this project (in its current state and with the goals expressed) would be so much simpler and more efficient written as a JSX pragma, without the React part.
Maybe there's more to the React functionality in this project that I'm missing. I don't want to discourage the author from doing something with React for this project—there's many directions you could take this that could make excellent use of React.
Great feedback. The points you make are good. Listed below are the reasons I chose to go with react.
1. I'm getting my feet wet with React rendering (I will be building a full react renderer in the future for another project)
2. It may be useful in the future for dynamic code editing (not sure but a possible use case)
3. Though react really shines in the render lifecycle, it does provide a nice pattern for building components. I see this project being used as a way to componentize composable code generators and snippets.
> I see this project being used as a way to componentize composable code generators and snippets.
You can do this without React though, using only JSX. I've implemented this pattern in a library (not open source yet) that builds in a lot of these composition patterns (pass children as child or prop, etc) so that you can use it in familiar ways while still just being JSX.
GitHub Trending Repository lists, for one. Some (idiot) third party sites use stars as some weird approximation metric for "quality" or "usefulness", for the other.
Some pretty big, wordy claims in your intro paragraphs (basically over the top marketing speak). Then the examples seem to completely miss the point for me. The examples include so much implicit knowledge, it's hard to follow.
What would I ever need to use this for? Looks useful if I were building a testing tool or IDE tool, but I can't see much use outside of that.
The Code component would do a poor job at nesting code in a body. The point of this project is to make it easy to generate code through an AST, hence the <Code /> "catch call".
Probably to learn about how ASTs and React rendering work.
I've had thoughts about writing a WebGL backend so I could describe a scene graph with React; this would probably be a good stepping stone to learn how to do that
If you just want an interface for building up an AST using composition, you can do this without React. You can even continue to use JSX—it's as simple as having a function definition to create AST primitives and have a JSX pragma that calls into it.
What React is excellent at is taking two trees and finding a set of mutations to transform the nodes from the first tree to the second—with utter disregard to how those trees came to be. That's what the renderer provides—the set of operations that can be performed on nodes.
I don't see how the actual React part can be used here. Even the suggested uses are all single-pass operations where this diffing will never come into play.
That said, to me this project (in its current state and with the goals expressed) would be so much simpler and more efficient written as a JSX pragma, without the React part.
Maybe there's more to the React functionality in this project that I'm missing. I don't want to discourage the author from doing something with React for this project—there's many directions you could take this that could make excellent use of React.