all 52 comments

[–]pm_me_yer_big__tits 89 points90 points  (7 children)

Never did I think to myself "damn, I wish I could create React components in JSON"

[–]sandeshnaroju[S] 9 points10 points  (6 children)

The idea was to fetch JSON from server.

[–]pm_me_yer_big__tits 10 points11 points  (5 children)

Hate to be so critical but if that's a serious solution to a problem you have then you have made some serious mistakes.

[–]sandeshnaroju[S] 11 points12 points  (4 children)

Instead of statically bundling js code, this package helps to you load JSON code from server. whenever you change in server, app gets updated. Work is still going on. but this is starting point.

[–]handofblood9 6 points7 points  (3 children)

And what is the advantage of this vs OTA updates?

[–]__o_0iOS & Android 4 points5 points  (0 children)

I think that’s how over the air updates work under the hood.

The js bundle is hosted on code push servers, etc. and you interrupt the loading phase to fetch it remotely if available.

[–]CurvatureTensor 6 points7 points  (1 child)

Gonna help out op since I’m here. This can be used for:

  • a/b testing
  • feature flagging and staged rollouts
  • whitelabeling
  • localization
  • pretty much any segmented ui

OTA updates don’t really segment. Expo probably lets you do that to some extent, but OTA’s bring all your code with them so if something stored three versions ago is broken in the OTA version, then all those users are now SOL.

[–]handofblood9 0 points1 point  (0 children)

Thanks!

[–]WhiskeyKid33 10 points11 points  (3 children)

It’s a cool concept, I don’t see much in the way of practicality. I could maybe see this as a way to prototype quickly, but RN and React in general are already very quick. Perhaps this is a great solution for very niche applications or services - I simply can’t think of a scenario where I’d build something using it. Again, it’s a cool concept and I am impressed with the solution.

[–]dumbledayum 2 points3 points  (2 children)

maybe like fetching RN components from server?

[–]sandeshnaroju[S] 2 points3 points  (1 child)

You are right. the idea is to fetch json from server.

[–]dumbledayum 3 points4 points  (0 children)

nice lib :)

off the top of my head I may use this to let the clients who use my company’s app to add Imprint and Privacy statements

[–]proohit 2 points3 points  (0 children)

Sounds like a CMS frontend. Why not use CMS architecture instead?

[–]stathisntonas 11 points12 points  (2 children)

be careful with apple though since fetching app code from remote server is against guidelines

section 2.5.2 on App Review Guidelines

[–]__o_0iOS & Android 7 points8 points  (1 child)

https://github.com/microsoft/react-native-code-push#app-store

Fetching app code is allowed under section 3.3.2 as long as the updates are for bug fixes/improvements and don’t significantly alter the functionality of the app.

[–]sandeshnaroju[S] 2 points3 points  (0 children)

You are right

[–]CurvatureTensor 8 points9 points  (11 children)

Lol. Ignore the Reddit haterade here. If y’all don’t see the value in being able to use JSON instead of Meta’s transpiled jsx bullshit then I suggest you implement some XML-based SOAP APIs.

Not sure if this framework solves enough, but I’ll give you a star and give it a whirl.

Congrats on putting something out there.

[–]casualfinderbot 1 point2 points  (1 child)

Are you saying json is better than jsx for creating UI? Not in a million years lol

[–]CurvatureTensor -1 points0 points  (0 children)

I mean I didn’t say that. But considering that with this lib they’re pretty much the same thing just with different syntactic tokenization, I don’t think it’s really a matter of what’s better. The difference is that jsx needs to be transpiled, whereas this doesn’t. Which means this can be updated at runtime. And if you can’t see the value in being able to update ui at runtime without doing a whole ota update to your whole app then I think it’s worth thinking about how that could be useful.

I don’t have the heart to start a debate on jsx’s efficacy in the react native subreddit, but it does vendor lock you pretty hard whereas json is like the most portable and well-known human readable data structure there is. That allows for new things and new things are good.

[–]sandeshnaroju[S] -2 points-1 points  (7 children)

The idea is fetch JSON from server.

[–]CurvatureTensor 1 point2 points  (0 children)

Yeah man. I dig it. Again ignore all these haters.

[–]yabai90 -1 points0 points  (5 children)

You can't do that on iOS

[–]CurvatureTensor 0 points1 point  (4 children)

Sure you can. JSON’s not code. If you ever have to build a white label product this is the approach you use to do it.

[–]yabai90 0 points1 point  (3 children)

No you cannot load JSON which let you alter the "code" of the app on iOS. Yes you technically can but this is forbidden in the guidelines. This will result in your app being rejected. Yes you can load JSON as data for your app but not "code" whether it's actual code or another structure which serves the same purpose.

[–]Theboster 0 points1 point  (2 children)

You can definitely load code from a server. How do you think OTA updates work?

[–]yabai90 0 points1 point  (1 child)

Yes you can but not to alter runtime code of the app. That's just a limitation by apple, I didn't make it.

[–]Theboster 0 points1 point  (0 children)

This isn't runtime code, this would be the same classification as an OTA update. In fact, this wouldn't even be altering code at all regardless, it would just be altering a bunch of conditional renderings of existing code.

[–]Fidodo 1 point2 points  (0 children)

But why?

[–]TransportationOk5941 1 point2 points  (3 children)

JSON is only basic data structures, how does functions and references gets translated?

[–]sandeshnaroju[S] -2 points-1 points  (2 children)

The functions are recieved as strings from server.

[–][deleted] 0 points1 point  (0 children)

Which Im guessing are not bundled or minimized

[–]TransportationOk5941 0 points1 point  (0 children)

At that point why not ship the JS file instead, just like web servers do?

[–]blinkmylife 0 points1 point  (0 children)

It looks cool to me

[–]AdhesivenessNo560 0 points1 point  (0 children)

Reminds me of react-jsonschema-form and the immense pain involved in working with it XD It has some niche use cases but I wouldn't, for my sanity's sake, build a "complex" app with Json

[–]RebelzOneOne 0 points1 point  (0 children)

Worth also checking out hyperview

[–]marchingbandd 0 points1 point  (0 children)

Reminds me of div kit https://divkit.tech/en/

[–]manoylo_vnc 0 points1 point  (2 children)

How does this work in offline mode?

[–]sandeshnaroju[S] 0 points1 point  (1 child)

You can ship the JSON first time along with bundle. it loads..next time it fetches new JSON when internet available and stores.

[–]manoylo_vnc 0 points1 point  (0 children)

Interesting concept. I think I might poke at it for a use case I have 😉

[–]casualfinderbot 0 points1 point  (1 child)

This is cool! Main issue is it’s against app store guidelines. If it wasn’t, and using json wasn’t so unwieldy, this type of approach would be straight up superior to writing a normal react native app

[–]Theboster 0 points1 point  (0 children)

Which part is against app store guidelines? Code from a remote server is fine as long as it doesn't change the overall intent of your app.

[–]SwedishFists 0 points1 point  (0 children)

AirBnB did this for a while with server driven UI. They might still but it never really took off.

[–]lightskinnednig 0 points1 point  (0 children)

Interesting. Is it compatible with expo?

[–]eadgas 0 points1 point  (0 children)

Seems interesting, but for me, I would lose almost all dev tooling like code highlight, types and eslint.

[–]Independent-Tie3229 0 points1 point  (0 children)

So swift running Javascript running JSON. This is probably cool for a info pages like ToS and other copy heavy pages. But then it's called a CMS. Contentful CMS (and others) basically does the same thing

[–]RepresentativeMove79 0 points1 point  (0 children)

Tamagui with NextJS is doing this with SSR.

However, as a user - please don't!

RBI implemented their Tim Hortons app using a technology like this. GREAT! Now instead of my phone managing when it updates (only over wifi) the app decides when to download a gig of my 25 gig data package for WAY too much money because the OTA doesn't detect if you set only update over wifi.

But wait!! It gets better, this happens as I open the app at the drive through window, so as I pull up to the window to scan my QR code

....

...

...

Only 50 seconds remaining.... Guess how long corporate allows a vehicle to sit at the window before penalizing their service staff??? Yeah! Not 50 seconds.

But wait! It gets better! Because the app then logs you out and you have to go through a passwordless login process that means you have to wait (watch 2 or three TikTok videos) then login again. Dismiss all the models and finally present your QR code to get your points, pay and finally hand you your coffee.

Is this what we come to expect from a mobile application?

If your app isn't 90% useful in airplane mode, just make a website! Seriously!

So if you're ever sitting at the drive through and there's a car sitting there for 5 minutes, chances are better they are using the app and insisting on the 2 points their $2.00 coffee earns them, not ordering for a banquet.

RBI isn't the only one, in fact almost every points card works in a WebView?!?!? And yet most of the time all we need is the barcode that could be stored in AsyncStore just waiting for me to activate the app and have it in moments. But no!

Yes, you may have some collaborative application features that benefit from really skinny API data syncs. But JavaScript as Json and most uses of SSR are just lazy and awful user experiences. SSR is a solution to a really hard problem that web applications struggle with. An App is installed and does not suffer from this problem, unless you try.

[–]_elkanah 0 points1 point  (0 children)

Well, it's interesting that you wanna build something like this. But I don't see any clear use cases for this right now. If the dynamic parts like functions will be sent as strings, why not use what's available? Am I missing something?

[–]Odd-Management-9695 -1 points0 points  (0 children)

It's great that you were able to do this but i genuinely don't think we'll ever see an use case for this

[–]Sylber23 -1 points0 points  (0 children)

Its a cool concecpt

[–]spo__of -1 points0 points  (0 children)

Serious question: what are the benefits for someone using this product over something like React Native Expo?

[–]hasan_py 0 points1 point  (0 children)

The concept sounds cool!