Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add props getter to the Component class #12

Open
one-more opened this issue Sep 5, 2019 · 0 comments
Open

add props getter to the Component class #12

one-more opened this issue Sep 5, 2019 · 0 comments
Labels

Comments

@one-more
Copy link
Owner

one-more commented Sep 5, 2019

There should be universal mechanism to get component's props:

in markup:

<x-clock id="clock" data-type="digital" ></x-clock>

in code:

import {Component} from '@micro-frontends/core'

export class XClock extends Component {
    static getName() {
        return 'x-clock'
    }

    render() {
        const id = this.props.id;
        if (this.props.type == 'digital') {
            //render digital clock
        } else {
            //render analog clock
        }
    }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant