How to use Stencil componennts with ionci 4 and angular


#1

Hey !

I just got into stencil and i wanted to know if it s possible already to use the generated webcomponents by stencil in my ionic 4 app whille still using angular and how ?

i downloaded the ionic 4.0.0-rc2 and i didn’t find anyway to use the CLI to generate a project that is not based on angularJS or angular so i s it not implemented yet ? or should i update the CLI on its own ?

I am a bit confused here.


#2

I might be wrong, but i use
ionic g component new-component

Then u have to declare it in providers and then use it with <new-component></new-component>


#3

That componenet is a stencil component or a regular angular component, because there is a difference and that is my question.


#4

Follow this, but for your own component: https://github.com/Aaron-Sterling/time-ago-web-component/blob/master/docs/ionic-angular-setup.md

Edit: unless you mean the already-created ionic-angular components? Then pretty much the same as with Ionic 3.


#5

ah i saw that, i was looking for an easier way actually. By your edit did you mean that in ionic 4 ion components are already built using stencil ? so using <ion-card></ion-car> means i am using the stencil built component or the usual ionic 33 angular component ?


#6

Yes. Ionic 4 looks about the same above the hood, but totally different beneath the hood. Almost all (maybe all?) components have been rebuilt with Stencil.


#7

Wow, that is great. So i started an ionic 4.0.0-rc2 app using the CLI which only gave me the choice of angular and angular1.x. is the other frameworks not available yet ? or is the CLI i installed is not the last ionic 4 compatible . ( i didn’t isntll the CLI manually, it just came with the ionic 4.0.0-rc2 install )

And ( i don’t want to continue with the questions but …) can i compile my old ionic 3 app using the new ionic 4 and get the performance upgrades or is that not possible yet ?


#8

I think your best bet is to check the changelog for the CLI and other projects. Answers to questions like his might change once or twice a week. But you can use your framework of choice and import Ionic 4 components to that. If you want to use Ionic-angular, you install Ionic as before. If you want to use React, use React, the way you used React before, except now you can import Ionic components like range or slides.