nativescript-preact
nativescript-preact copied to clipboard
Build cross-platform iOS and Android apps using Preact.
NativeScript Preact
This plugin integrates Preact and NativeScript, allowing you to build cross-platform iOS and Android apps using Preact.
Why? Because I prefer the (P)React pattern of building UIs over what Angular offers, and find that NativeScript has several technical advantages over ReactNative.
Getting Started
- Install NativeScript CLI
- Generate a new repo based on NativeScript Preact Template
- Clone your new repo.
-
npm install
andnativescript run android
(orios
)
This is Alpha Software!
This is a very early working example, and should not be used for a production app unless you really know what you're doing. I hope to build a side-project using this as well as add unit tests for all NativeScript components.
How it Works
This was made possible by undom library, allowing Preact to rending into a pure JavaScript DOM, within the NativeScript runtime. Currently, I'm shipping a modified undom with basic MutationObserver API implemented which is what nativescript-preact uses to sync changes from the DOM to the NativeScript widgets. I aimed to keep this code generalized (and hopefully small), so the bridge code is easier to maintain and less prone to bugs.
Get Involved!
File issues! Feel free to post questions as issues here or look for the #preact
channel on the NativeScript Slack Community.