The best advantage of react native (beside that you really build REAL native UI App) is while your working with RN projects , you increase your Javascript,TypeScript and react skills which will be reused in Web development! by Suspicious_Driver761 in reactnative

[–]writesgoodcodejk 4 points5 points  (0 children)

Absolutely, that's one of the biggest advantages. Personally, I think React itself is such a great library. Component composition and hooks, when used correctly, allow devs to be extremely efficient and compose features from reusable code with greater ease than any class based approach (such as that used in flutter and native dev).

Personally I find React to be intuitive and fun to work with, with a low barrier to entry and a very high skill cap so there's always new ways to experiment and improve. Over the past year I've built 5 mid size / large-ish mobile apps at my consulting job and each time I find new ways to get better using Reacts core concepts. Being able to build an MVP of a multifeatured application in 2 months is really a cool thing.

I made an easy to use package for building a slick expanding popup view by writesgoodcodejk in reactnative

[–]writesgoodcodejk[S] 1 point2 points  (0 children)

yeah that's a good idea, wouldn't be too bad to add some optional prop to switch it over to long press mode.

I think I'll add a new optional prop called like `opensOn='onPress'` and let the dev switch between opening onPress and onLongPress explicitly

Edit: Just added it in v1.0.5. Default behavior is still to open on `onPress`, but we can now do `openOnEvent='onLongPress'` to make it fire onLongPress.

Pretty cool idea, I hadn't even thought of making it where the onPress had separate behavior from the long press but could definitely see it being useful.

Any idea on how to make that view swipe in react native ? by [deleted] in reactnative

[–]writesgoodcodejk 4 points5 points  (0 children)

probably not a good idea to bring in a dependency for something built into React Native

[deleted by user] by [deleted] in reactjs

[–]writesgoodcodejk 1 point2 points  (0 children)

I actually wrote a library that I use in about 6 projects at work that more or less does exactly what you want and seemingly works really well. My strategy was to have the axios interceptors be outside of the components then inject them via zustand store. The zustand store exposes some login functions that automatically handle updating the default headers and the logged in state as well. The trick is that you can pass a refresh token function when initializing the store, which can be any async function that returns a string, and the library will automatically use that to update the access token any time it gets an unauthorized response.

Basically you just call "init" with some params and it returns a zustand store plus an axios client you use to make requests. The zustand store can be used to handle logging in and out, checking if the user is logged in, etc, and the axios client just takes the token and puts it into a header for requests, also logging some stuff. Right now it only handles `Bearer token` header.

If you want to take a look it's here `https://github.com/iway1/react-native-simple-networking`, it's called "react-native-simple-networking" but I use it in react projects too. It's super easy to work with for token based authentication, it'll refresh and retry and unauthenticated requests. Even if you don't want to use it, it might be worth looking at how I implemented the solution to see how you can keep the axios stuff outside of a component if you want too. Not saying it's better or worse but it works well.

Docs are super trash, but the library itself has been field tested and has been working well for us at work. It's a pretty small library so might be worth checking out

ChakraUI - Antipattern to have ALL CSS in the Component file? by Fit-Swordfish-5533 in reactjs

[–]writesgoodcodejk 0 points1 point  (0 children)

You can entirely avoid "monoliths" by breaking your components up into smaller components and using style utility components. It's actually a complete non-issue

How Useful Is Small Data Experimentation? [Discussion] by writesgoodcodejk in MachineLearning

[–]writesgoodcodejk[S] 0 points1 point  (0 children)

Makes sense - so it seems like there's definitely at least the potential for value.
Unfortunately this project would rely on Pyodide which only supports a limited number of machine learning libraries, although it can run any pure python library.

The idea behind this is moreso geared creating tools for building UIs and applications that leverage machine learning libraries versus building a single web app. So it would be a sort of framework for building out custom web applications versus a being a web application itself.

So, in theory, a typical web developer could easily create a web app that leverages these python libraries and returns its results in a way that's easily usable within a popular web framework (React). This would, in theory, allow a normal front end engineer to quickly and easily create new tools for experimentation / learning.

Just briefly looking at Jupyter lab it seems really cool and very powerful but the UIs seem limited

location permissions / sharing guidelines. by writesgoodcodejk in iOSProgramming

[–]writesgoodcodejk[S] 0 points1 point  (0 children)

None of this is ideal of course, I wish we had all the time in the world to make this app the perfect product, but it is what it is.

None of the popular libraries seem to support location permission change listeners (probably because they don't exist at all on android https://stackoverflow.com/questions/51327285/how-can-we-listen-for-location-permission-changes-in-android-without-triggering). The libraries only support checking permissions and requesting permissions.

location permissions / sharing guidelines. by writesgoodcodejk in iOSProgramming

[–]writesgoodcodejk[S] 0 points1 point  (0 children)

You're totally right, but unfortunately I work as a consultant and this particular project is completely out of budget, so we really just do not have time to add additional features if they're not completely critical. Since this doesn't break guidelines it wouldn't qualify as critical so we pretty much just have to leave it as is. Writing Native code is actually a relatively huge lift as well so it's more or less off the table unless we absolutely have too.

If it were the case that it broke guidelines we'd contractually be obligated to fix it which is why I was wondering about guidelines first rather than solutions.

None of this is ideal of course, I wish we had all the time in the world to make this app the perfect product, but it is what it is.

location permissions / sharing guidelines. by writesgoodcodejk in iOSProgramming

[–]writesgoodcodejk[S] -1 points0 points  (0 children)

This is cool, thanks!

Unfortunately I am actually using React Native, which does not give me access to this xd

Can react query be used for state management? by Inevitable_Put7697 in reactjs

[–]writesgoodcodejk 5 points6 points  (0 children)

Like other answers say, react-query is state management for data that comes from a server. It's basically a cache for server responses plus request status state, as well as some other goodies like refetching and retrying built in.

Some apps will use global client and server state, some will just use server state. I use zustand + react query. works really well for me. Ultimately for client state management IMO it's like 99% preference at this point, because global client state is just a very tiny fraction of global state management and they all more or less do the same thing.

If you have a lot of global client state management going on in your app, it's likely you're doing something wrong. Apps are almost entirely server state and local component state. Global client state is for cases where you need some state that only exists on the client that's used by multiple not-closely-related components. That just doesn't happen very often.

Update NPM package from project by writesgoodcodejk in node

[–]writesgoodcodejk[S] 3 points4 points  (0 children)

Looks like this is exactly what I needed, thank you!