Skip to content

v0.1.1 - syntactic sugar

Compare
Choose a tag to compare
@ayushmanchhabra ayushmanchhabra released this 16 Feb 11:11
· 789 commits to main since this release

User defined JSX components are now also treated as JSX in comparison to just functions. This is possible because the createElement function argument tag is now a string or function type. Every time tag is a function type, the function that is the user defined component with the createElement applied is called (basically syntactic sugar).

Here's an example:

Before, a user defined JSX component would be treated as a function and called like so:

const A = () => <div>A</div>

const B = () => {
    return
    (
        <div>
            {A()}
        </div>
    )
}

Now, the user defined JSX component is treated like a JSX element but is called like function via createElement.

const A = () => <div>A</div>

const B = () => {
    return
    (
        <div>
            <A />
        </div>
    )
}

To clarify, the component can be called via a function call.

Full Changelog: v0.1.0...v0.1.1