When I set compat: true in preact, will I be able to use non react, normal preact…
- User
When I set compat: true in preact, will I be able to use non react, normal preact components as they are with full performance. I want to be able to use simple components with full preact functionality however I am worried if I turn compat: true just to import some react components I will lose performance and greatness of overall preact functionality. Can you explain to me how compat: true effects overall performance of preact ?
- Assistant
Setting
compat: truein Preact allows you to use Preact's compatibility layer called 'preact-compat', which makes Preact more compatible with React.When you enable
compat, you can use both React and Preact components side by side in your application without any issues. Preact components will still work as they would with full performance and functionality, while also enabling the use of some React components.However, enabling
compatmay come with a few trade-offs:-
Bundle size: It will add some extra bundle size to your application because the 'preact-compat' layer (which is an alias to 'preact/compat') has some additional code to ensure compatibility with React.
-