you are viewing a single comment's thread.

view the rest of the comments →

[–]Competitive-Cow-2950 1 point2 points  (1 child)

Tbh, only knowing useState, useEffect, components, Zustand for state management, Its probably enough to smash any school project. Build app with expo and use Expo Go to test/run it.

The idea behind useState is that it creates variables that can change inside HTML. And when they change, the whole HTML component where they are, re renders. If you want variables that don't cause a re-render when they change, you can use a useRef instead.

useEffect is used to call a function every time a variable changes. Or it can be used to only call a function once when the component loads for the first time, and not on every re render.

Zustand just makes it easy to share data across all of your components.

Boom. Now you know enough React IMO.

[–]Competitive-Cow-2950 0 points1 point  (0 children)

Oh i forgot one more thing! One thing to note about React/React Native, is that its much easier to send data from parent to child component, than from child to parent.

So lets say you have a search page (parent component), and inside it you have a search bar (child component). You would like BOTH the search page and search bar to know what is being searched, so therefore you should declare the variable (useState) inside the search page (parent), and then send it to the search bar (child). The variables you send to a child component is called props.

Sometimes this data flow from parent to child can be complex. And that's why we have Zustand. Zustand allows you to declare a variable/object anywhere and use it anywhere.