Skip to content

Added @:jsxStatic#81

Merged
elsassph merged 1 commit intomassive-oss:masterfrom
kLabz:feature/jsxStatic
Oct 4, 2017
Merged

Added @:jsxStatic#81
elsassph merged 1 commit intomassive-oss:masterfrom
kLabz:feature/jsxStatic

Conversation

@kLabz
Copy link
Contributor

@kLabz kLabz commented Oct 1, 2017

@:jsxStatic can be used to create functional components:

@:jsxStatic('render')
class Link {
    static function render(props:LinkProps)
    {
        return jsx('<a href={props.to}>{props.children}</a>');
    } 
}

// usage
function render()
{
     return jsx('<Link to="abc">Abc</Link>');
}

// replaced by
function render()
{
     return jsx('<Link.render to="abc">Abc</Link.render>');
}

Sorry for the whitespace too, these changes are the same as the other PR. You can view the diff without whitespace diff by adding &w=1 to the url.

var type = isHtml ? macro $v{path[0]} : macro $p{path};
type.pos = pos;

parseJsxStatic(type);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe only if (!isHtml)?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, I'll fix that

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated :)

@kLabz kLabz force-pushed the feature/jsxStatic branch from 1d54bd2 to a13c93a Compare October 3, 2017 12:47
@elsassph elsassph merged commit 078f26f into massive-oss:master Oct 4, 2017
@kLabz kLabz deleted the feature/jsxStatic branch January 17, 2019 08:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants