0

I wan't to import components and use them just like in Vue or ReactJs. Where you can

export default component

And import it by using

import Name from './path/to/component';

and finally use it

How can I do this same thing but on Magento 2? I know that on top I can use require or define, but when I import the component can't use it's template or functions just like in React the functional components.

For example:

define(['jquery', 'uiComponent', 'ko', 'Vendor_Module/js/component'], function ($, Component, ko, customComponent) {

  customComponent //here I expect to use it's template and also send props o get data from it
}

Greetings!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.