vitalipe / react-hut Goto Github PK
View Code? Open in Web Editor NEWMake your React components pretty again!
License: MIT License
Make your React components pretty again!
License: MIT License
["div",
["a", "thing", "that is not a component"]]
wll be evaluated to the same thing as this (in JSX):
<div><a>thing, that is not a component</a></div>
but we actually want this:
<div>a thing, that is not a component</div>
:(
Tags like "b", "article", "header", etc are common words.. nested array children are
not that common, but can happen when calling map:
let wordsThatIKnow = ["a", "article", "blah"];
["label.starts-with-a",
wordsThatIKnow.filter(word => world[0] === "a")]
By adding a prefix ":" be can almost avoid this edge case:
[":div",
["a", "thing", "that is not a component"]]
and it also allows me to add syntax highlighting to the first string that starts with ":" in an array.
I also considered 3 alternatives:
[H.div, ....]
[H.div("some.class-name-here"), ...]
[H("div.some.class-name-here"), ...]
[[H, "div"], .....]
["div.parent", [["a"], ["a"]]]
option 1 sucks because sooner or later someone will call .filter..
and I don't have a way to protect against it, the rules of the system are correct,
it's the data that is "bad"..
option 2 can be easily implemented on top of this library.
option 3 is what I implemented initially and didn't like it at all, too much ]]]]]]]]] (I'm a LISP fan, I like my brackets round :P ).
any other ideas are welcome :)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.