Giter Club home page Giter Club logo

react-hut's People

Contributors

vitalipe avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

react-hut's Issues

removing the ":" prefix on component names

["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:

  1. to create our own map/filter functions:
  2. Use symbols or some kind of identifier, some options:
    [H.div, ....]
    [H.div("some.class-name-here"), ...]
    [H("div.some.class-name-here"), ...]
    [[H, "div"], .....]
  3. to always wrap with an extra array:
["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 :)

@giltayar ?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.