How to use Mobx with React Hooks

  Рет қаралды 32,653

Ben Awad

Ben Awad

Күн бұрын

Пікірлер: 62
@SaleemKhan-ln3ly
@SaleemKhan-ln3ly 4 жыл бұрын
I was wondering why did you wrap the count store in context, when we can use the store directly? is there any advantage of wrapping it in context?
@bawad
@bawad 4 жыл бұрын
I don't think so, at the time I didn't know you could use it directly
@loba8924
@loba8924 2 жыл бұрын
where is the second part?
@qazyhn94
@qazyhn94 5 жыл бұрын
this tutorial is sick, I like it!!
@MrJoaopaulofurtado
@MrJoaopaulofurtado 4 жыл бұрын
How do I persist state with mobx and react hooks?
@muzamilhussain9908
@muzamilhussain9908 3 жыл бұрын
can any one tell me how this is different from context api
@impzeropvp
@impzeropvp 6 жыл бұрын
Where are you willing to store the workouts data, firebase?
@bawad
@bawad 6 жыл бұрын
I was going to store them in localStorage
@techstacker5361
@techstacker5361 6 жыл бұрын
@@bawad if it's localStorage, then you won't be able to access the same exercise data on the web/mobile version? Or will the data be sync’d between mobile & web?
@bawad
@bawad 6 жыл бұрын
yeah we won't be syncing between app/website, so each will have different data
@fr3fou
@fr3fou 6 жыл бұрын
How do you decide when to use interface vs type
@bawad
@bawad 6 жыл бұрын
interface for objects and types for everything else
@arafatzahan3697
@arafatzahan3697 4 жыл бұрын
@@bawad OOh my, never thought it like that. Makes too much sense now haha
@punreachrany5706
@punreachrany5706 3 жыл бұрын
Do I have to write in Typescript if I want to use mobX?
@zulq2075
@zulq2075 5 жыл бұрын
i'm getting error * error: bundling failed: Error: Unable to resolve module `mobx-react-lite`* if i go to root directory node_modules it showing me *mobx-react-lite*. can u plz help me
@zulq2075
@zulq2075 5 жыл бұрын
it's working on the web but not on native
@bawad
@bawad 5 жыл бұрын
I couldn't get the native to work either
@zulq2075
@zulq2075 5 жыл бұрын
@@bawad so why we created three folder(web, common, app) , is there any method so i can i use only one codebase for web and mobile.
@bawad
@bawad 5 жыл бұрын
yeah, checkout expo web
@minionsmedia1761
@minionsmedia1761 4 жыл бұрын
@@bawad Did this thing started working on native now ? curious.....
@danieldosen5260
@danieldosen5260 6 жыл бұрын
I like using the data format like '2019-02-19' as that's how postgresql uses/displays dates natively.
@bawad
@bawad 6 жыл бұрын
I'm cool with using that
@wagnercsfilho
@wagnercsfilho 4 жыл бұрын
Provider component?
@mayur9876
@mayur9876 6 жыл бұрын
Amazing content as always
@bawad
@bawad 6 жыл бұрын
thanks!
@muratasarslan2359
@muratasarslan2359 5 жыл бұрын
Very helpful, thank you Ben.
@goulenstring
@goulenstring 5 жыл бұрын
Only works with JS scalar types (types.string, types.number, etc..). If MobX Store property if of type "types.array(Other model)" or "types.map(Other model)", react hooks does not take care of those properties updates (useEffect/useMemo/etc). Do you why ?
@bawad
@bawad 5 жыл бұрын
Weird, I'm not sure
@aleksandarhough7710
@aleksandarhough7710 4 жыл бұрын
fantastic tutorial!! thanks
@gonzalochristobal
@gonzalochristobal 5 жыл бұрын
how difficult it will be to create a react-native-web-cli with a create-rnw command that creates a folder with all the packages configurated? i dont have any idea of how to do it, but it will be a good exercise if you ask me, i'm in to try to help if you want to do it
@gonzalochristobal
@gonzalochristobal 5 жыл бұрын
a workspace generator
@gonzalochristobal
@gonzalochristobal 5 жыл бұрын
its kinda hard getting the workspace configurated to get up and running
@bawad
@bawad 5 жыл бұрын
yeoman.io/authoring/index.html
@gonzalochristobal
@gonzalochristobal 5 жыл бұрын
@@bawad thanks!
@kresimircosic3753
@kresimircosic3753 5 жыл бұрын
Very cool, I am having difficulties with MobX now, the page renders indefinitely after a Promise with data resolves and fills up an array with data. No idea why...
@Chocoholic1337
@Chocoholic1337 6 жыл бұрын
Silly question perhaps, but CMD + Space doesn't open up the intellisense / import thingy... How did you set that up? And what is currently set to your CTRL + period?
@bawad
@bawad 6 жыл бұрын
They are default keybindings CTRL + Space brings up intellisense CMD + period brings up quick fix menu which includes imports
@gosnooky
@gosnooky 5 жыл бұрын
Getting the "Invalid Hook Call" error when using the useContext hook when the component is wrapped in observer()
@danieldosen5260
@danieldosen5260 6 жыл бұрын
Will you build in an ability for the React-Native app to work 'offline' / not connected to a server?
@bawad
@bawad 6 жыл бұрын
yeah, we are going to be saving the data to AsyncStorage/Localstorage
@natanaelfernandes2565
@natanaelfernandes2565 4 жыл бұрын
saved me, works fine!
@Lessep922
@Lessep922 6 жыл бұрын
Seems good BUT i think using mobx with hooks is not ideal (or maybe i still dont get it) why? because the magic of mobx is that you pick which properties you want your component to listen without all that extra setup by default. Anyway you're awesome Ben!
@bawad
@bawad 6 жыл бұрын
I think it still works like that. The component we made will listen for when the count field changes. Hooks just make the syntax for it a little different.
@SalientKnight
@SalientKnight 5 жыл бұрын
I don't have a tsconfig or a jsconfig. I've been in hell trying to get rid of this error -- using CRA3 and JS
@bawad
@bawad 5 жыл бұрын
I think you need to add a babel plugin
@MarioIliev
@MarioIliev 3 жыл бұрын
Damn that's a boilerplate that I would liike to avoid. I prefer something easy to use like "Store me".
@deannno1
@deannno1 6 жыл бұрын
I just don't understand anymore why use something else to manage the store, than the context.
@Chocoholic1337
@Chocoholic1337 6 жыл бұрын
From my own experience: context is used for shared component state / props that don't change often or that isn't complex (application-wide theme as example). As soon as you start using complex state logic, a store starts to make a lot more sense. I'm sure Ben can give his own experience on the matter.
@bawad
@bawad 6 жыл бұрын
mobx is an alternative to useState, either way you would/could use context
@devilmanscott
@devilmanscott 6 жыл бұрын
One main reason usually more tooling, but another is that it's normally more optimised.
@chaimochs7437
@chaimochs7437 4 жыл бұрын
@@bawad So, I should use both observables/observers and context?
@trejohnson7677
@trejohnson7677 5 ай бұрын
ancient knowledge repository.
Navigation in React Native Web
14:33
Ben Awad
Рет қаралды 13 М.
Why Signals Are Better Than React Hooks
16:30
Web Dev Simplified
Рет қаралды 497 М.
We Attempted The Impossible 😱
00:54
Topper Guild
Рет қаралды 56 МЛН
Quando eu quero Sushi (sem desperdiçar) 🍣
00:26
Los Wagners
Рет қаралды 15 МЛН
React + RxJS = Reactive Global Goodness
26:46
Jack Herrington
Рет қаралды 43 М.
What Programming Font Should You Use?
4:12
Ben Awad
Рет қаралды 49 М.
How React Query Won
34:52
Theo - t3․gg
Рет қаралды 90 М.
Mobx React - State Management Alternative to Redux
14:26
Monsterlessons Academy
Рет қаралды 10 М.
Introduction to MobX & React in 2020
16:51
Leigh Halliday
Рет қаралды 66 М.
Знакомство с MobX | Вебинар | karpov.courses dev
1:50:44
KARPOV.COURSES DEV
Рет қаралды 4,8 М.
Intro to MobX-State-Tree
15:23
Jamon's Code Quests
Рет қаралды 6 М.
Why I Moved from React Redux to Zustand and Why You Should Too!
19:24
How to Roll Your Own Auth
13:05
Ben Awad
Рет қаралды 126 М.