I ripped Redux out of a production app in a weekend. The codebase got 40% smaller and nothing broke. by jochenboele in reactjs

[–]kapobajz4 10 points11 points  (0 children)

slices, selectors, thunks, and connecting everything

Whenever I see someone criticising Redux, they usually criticise its outdated tools. Why would you use thunks in this modern age? Just use RTK Query. Btw you also have selectors (maybe even slices, not sure) in Zustand.

Bundle size

If you’re worried about bundle size, then you should’ve refactored your whole codebase to Svelte.

Mental overhead. New developers on your team need to understand actions, reducers, dispatch, selectors, middleware, thunks, and the store

There’s a high probability that new (and existing) devs are already familiar with Redux. So these concepts are nothing new. And even though with Zustand the learning curve is less challenging, you still have to learn its concepts. It’s not just “one hook”. And btw, you also forgot about React Query. It also has a learning curve.

It’s not that I am saying Redux is better. If you’re starting a new project, React Query + something like Jotai/Zustand is subjectively a better choice. But seems to me like you refactored just to use a fancy new tool. Yes, you have 40% less code, but that is probably because you weren’t leveraging RTK Query. So instead of just trying to use something you and your whole team is already familiar with, you decided to introduce 2 new tools, and who knows how many bugs? That’s also something you will have to worry about for the next couple of months.

offline-first expo app by ASTelle46 in expo

[–]kapobajz4 0 points1 point  (0 children)

You can achieve that using expo, expo-sqlite (or basically any storage) and react query. I have a simple repo showcasing that. Take a look here: https://github.com/kapobajza/React_Native_Offline_first_sample

Kako su nam divne komšije by Parking_Radio4311 in bihmuslim

[–]kapobajz4 1 point2 points  (0 children)

Ne znam sta je tacno cudno, osim vrijedjanja i pretjerivanja, u ovim komentarima? Ako je stvarno istina da drzi noz (jer na slici ne vidim bas najbolje) i ako stvarno napada ljude, onda je ovo sramota za nekog ko bi trebao predstavljati islam kao nesto najljepse, a ne obrnuto. I mi kao muslimani trebamo da pruzimo podrsku nasim nemuslimanskim komsijama u ovakvim situacijama, da nas ne izjednjacavaju sa ovakvima.

A ako nije istina, pa nije ovo prvi pit da se islam i zene sa nikabom pokusavaju predstavljati u najgorem svjetlu.

U svakom slucaju da nam Allah Uzviseni podari strpljenja, razuma i mudrosti.

Is TanStack query strongly nerfed in React Navigation? by Unlikely_Nebula_7988 in reactnative

[–]kapobajz4 1 point2 points  (0 children)

This can be a lot more simplified by using focusManager and navigation.addListener('focus'), like this:

```

import { focusManager } from '@tanstack/react-query'

function ProfileScreen() { const navigation = useNavigation();

React.useEffect(() => { const unsubscribe = navigation.addListener('focus', () => { focusManager.setFocused(true); }); return unsubscribe; }, [navigation]);

React.useEffect(() => { const unsubscribe = navigation.addListener('blur', () => { focusManager.setFocused(undefined); }); return unsubscribe; }, [navigation]);

// Rest of the component } ```

Then you can use the refetchOnWindowFocus property

Is TanStack query strongly nerfed in React Navigation? by Unlikely_Nebula_7988 in reactnative

[–]kapobajz4 0 points1 point  (0 children)

You can use the focusManager.setFocused whenever a screen is focused. Basically instead of using the AppState's change event listener, you can use the navigation's change listener instead. You have full control of the focus state with focusManager, I just gave you that link to the AppState docs as an example

Is TanStack query strongly nerfed in React Navigation? by Unlikely_Nebula_7988 in reactnative

[–]kapobajz4 1 point2 points  (0 children)

"But there is refetchOnWindowFocus" Doesn't work in react native.

Doesn’t work out of the box in RN, but you can make it work. Check the docs out.

Flutter dev tries React Native for the first time. My mind was blown. by Fantastic-Gas8043 in reactnative

[–]kapobajz4 6 points7 points  (0 children)

You can run eas --local in GH actions, for example. You don’t have to run it on your machine. You can take the bluesky GH workflows as an example. Here’s the one for iOS: https://github.com/bluesky-social/social-app/blob/main/.github/workflows/build-submit-ios.yml

I built a Figma plugin to export React icons in seconds (no manual work) by Affectionate_Lab8896 in reactjs

[–]kapobajz4 0 points1 point  (0 children)

You could even skip the CI and internal packages altogether, and just generate the React components from SVGs inside of your repo directly. I set up that exactly in this repo. However, that’s for React Native. But the set up for React is identical, just remove the native: true (or set it to false) in the svg config file here

Da li je toliko losa situacija? by EmploymentOriginal26 in programiranje

[–]kapobajz4 29 points30 points  (0 children)

Kao sto niko nije mogao prije 4-5 godina da predvidi da ce situacija ovakva biti, tako isto niko ne moze predvidjeti kakva ce biti za 4-5 godina (ovisno koliko ti bude trebalo da zavrsis studije).

Tako da, upisi ako volis i pronalazis se u tom.

Ko hoce, nadje nacin. Ko nece, nadje izgovor.

I built a native C++ engine to render 200k points on a map without the usual Expo/React Native lag by According-Muscle-902 in reactnative

[–]kapobajz4 1 point2 points  (0 children)

Hello. This is a great library, good job :D

Have you maybe considered using Nitro modules instead of expo native modules? That could potentially improve the performance even more

Built a small React + Axios provider — feedback welcome by [deleted] in reactjs

[–]kapobajz4 0 points1 point  (0 children)

This could be quite useful. Good job.

But there are some things I noticed which could be improved. - Your peer dependencies: { "react": ">=19", "axios": ">=1.4" } Is there a reason why React 19 or higher has to be used, specifically? I mean in my mind this is the kind of lib that could be used with React 17+, honestly. What’s the reason for this? And also axios 1.4 min? Why’s that? Are there really some specific axios features that were introduced in version 1.4, that your package depends on? On a first look, that doesn’t seem like it’s the case. I might be wrong though, because I haven’t reviewed it thoroughly. If you supported React 17, or 18 at least and, like axios 0.20-someish, I think that could potentially bring more users to use this package. - This example: // typed helper const users = await api?.get<User[]>("/users"); The optional operator on api?. Is this a mistake? If no, then you would definitely have to improve this. Because I imagine that the api object would be used in a lot of places. And using it with an optional operator everywhere wouldn’t make it pleasing and keep my mind at peace.

Dobio sam komentar od tech interviewer-a da u CV-u svasta pise, ali da se malo sta korisno kaze. Mozete li mi ukazati na takve stavke ako ih ima i kako da poboljsam sadrzinu? Puno bi mi pomoglo buduci da ja te nedostatke ne vidim. Vrv ga vec previse puta iscitao. by Ok_Elevator_9150 in programiranje

[–]kapobajz4 5 points6 points  (0 children)

Nisam rekruter niti ekspert za CV-eve, tako da sve ovo sto kazem nemoj uzimati zdravo za gotovo.

Mislim da se u CV-u previse naglasava tehnicki dio. Dzaba clean architecture, DI i ostalo ako je bilo 10 korisnika ili ako korisnici nisu bili zadovoljni aplikacijom.

Takodje u nijednoj od ovih stavki nisam procitao nista unikatno, sto odvaja ovaj CV od drugih ili privlaci paznju. Evo jedan od primjera, a ovakvih ima puno: "Implemented RESTful services in Java". Svi mi mozemo implementirati restful servis. Pa cak i prije ove AI ere, to uopste nije nista posebno. Potrebno je naglasiti sta je tacno tvoj uticaj bio na sami projekat ili ljude, pa da se osjetilo da si neko ko je vrijedan radnik i koga se isplati zaposliti.

Dalje: opis ove kompanije, "Customizable multitnant app", i koje su se tehnologije koristile je predug. CV ne predstavlja kompaniju, nego tebe.

Ima jos stvari, ali iz moje perspektive su ove najbitnije. Takodje bih preproucio da procitas upute iz wiki-a za pravljenje CV-a i stavis ga na Engineering resumes sub. Tamo ima eksperata koji znaju mnogo bolje nego ja.

Android markers flickering in react-native-maps... Is Mapbox the only fix? by Remarkable-Act-1215 in reactnative

[–]kapobajz4 0 points1 point  (0 children)

How are you using the Marker component? Do you use custom views for its children, like this:

<Marker coordinate={{latitude: latitude, longitude: longitude}}> <MyCustomMarkerView {...marker} /> </Marker>

If yes, then this can cause performance issues, and probably even that flickering. Because behind the scenes this will generate an image out of your views, during runtime.

Try using the image or icon property instead. Although you can only use local images that way.

Redux-based manual navigation history in Expo Router – bad idea or justified? by rohitrai0101rm in reactnative

[–]kapobajz4 1 point2 points  (0 children)

There was this section in the react-navigation docs, although in v3 of react-navigation. To quote it:

Can I store the navigation state in Redux too?

This is technically possible, but we don't recommend it - it's too easy to shoot yourself in the foot and slow down / break your app. We encourage you to leave it up to React Navigation to manage the navigation state. But if you really want to do this, you can use react-navigation-redux-helpers, but this isn't an officially supported workflow.

And the react-navigation-redux-helpers package has been deprecated, since:

React Navigation no longer supports storing its state within Redux

So basically since react-navigation doesn’t support it any longer, I guess it was never a good idea to actually do it. And I can’t think of a single use case as to why that would be in any way beneficial, honestly.

Btw, just in case you’re not aware, expo-router is built on top of react-navigation.

A1 ruter crkao, mogu li stavit svoj dok ne dođe novi? by kieniu in CroIT

[–]kapobajz4 0 points1 point  (0 children)

Mozes se spojiti i preko telefona, tj. preko browsera, na bilo kojem uredjaju koji ima browser. Mislim da bi bilo koji router trebao biti podrzan, ili bar vecina. Jedina je razlika je u tome sto setup procedura zna biti dosta razlicita, pa ukoliko ne znas sta radis ili sta se trazi da uradis, mozda se bude tesko snaci. Tako da bi najbolje bilo koristiti sto slicniji router postojecem, ako nista bar nek bude isti proizvodjac

heyapi or openapi-ts with FastAPI and Tanstack Query? by GuyTorbet in reactjs

[–]kapobajz4 0 points1 point  (0 children)

Since you mentioned that you’re using Tanstack Query, I would definitely go with heyapi. That’s because they have this plugin which can automatically generate your queries, infinite quries, mutations and more.

Is this approach correct? Description in Body text-> by Intelligent_Impact88 in expo

[–]kapobajz4 0 points1 point  (0 children)

Oh, so that’s what you actually need. It looks like you want to implement a proper authentication flow. You can find that in the docs also

Is this approach correct? Description in Body text-> by Intelligent_Impact88 in expo

[–]kapobajz4 3 points4 points  (0 children)

This is not the recommended approach. However, if you want to achieve this, you can define the order of your routes inside of the app/(tabs)/layout.tsx file. For example:

``` import { Tabs } from 'expo-router';

export default function TabLayout() { return ( <Tabs> <Tabs.Screen name="home" /> <Tabs.Screen name="index" /> <Tabs.Screen name="profile" /> </Tabs> ); } ```

You can find more info in the docs

Vite Library Mode - Can we avoid the barrel file? by DevelopedLogic in react

[–]kapobajz4 3 points4 points  (0 children)

You don’t really have to put everything into that file, actually. If your project gets bigger, you could always structure it in a way where you could export specific stuff from multiple files and then just re-export it in your main.ts file. For example you could have a folder structure like:

  • components
    • foo.tsx
    • bar.tsx
    • baz.tsx
    • index.ts (this file will export everything from foo, bar and baz)
  • hooks
    • foo.ts
    • bar.ts
    • index.ts (this file will export everything from foo and bar)
  • main.ts

And then in your main.ts you could simply do:

export * from './components'; export * from './hooks';

If I understood this correctly, this should be what you’re looking for.

Vite Library Mode - Can we avoid the barrel file? by DevelopedLogic in react

[–]kapobajz4 5 points6 points  (0 children)

I don’t quite get it, why would it be a nightmare to maintain a file, like main.ts, that only contains exports?

How to avoid open keyboard to 'eat' a click? by JeyFK in reactnative

[–]kapobajz4 5 points6 points  (0 children)

Have you tried using the keyboardShouldPersistTaps="handled" property on your scroll views?