Path To A Clean(er) React Architecture - API Layer & Data Transformations

  Рет қаралды 8,705

Profy dev

Profy dev

25 күн бұрын

Step 3 in the architecture cleanup:
Move transformations of API data to a shared API layer. This hides the complexity of the response data structures decoupling API and UI code.
Here’s the blog post including a course waitlist: profy.dev/article/react-archi...

Пікірлер: 22
@panchcw
@panchcw 19 күн бұрын
Really helpfull On KZbin there are a lot of tutorials about basic stuff but these are the real gems.keep it up
@bryant3060
@bryant3060 18 күн бұрын
I am having the exact same problems currently in my app! Thank you for this series!
@gauravrawat7175
@gauravrawat7175 23 күн бұрын
keep these videos coming, really helpful. lots of love.
@sayedaliaqamousavi9064
@sayedaliaqamousavi9064 15 күн бұрын
I was looking for such kind of videos. Thanks, alot.
@user-yz2mv8kn4x
@user-yz2mv8kn4x 23 күн бұрын
found these refactoring videos extremely helpful and insightful. thank you so much. 🙏
@profydev
@profydev 23 күн бұрын
Thanks a lot for the feedback. More videos to come :)
@abbaskareem5281
@abbaskareem5281 22 күн бұрын
I hope you make a video on pagination with limit&offset and filters (query params)
@BRP-Moto-Tips
@BRP-Moto-Tips 18 күн бұрын
depending on what youre building you might want to extract that logic into a hook, i usually work with dashboards and its great because each table has it own hook instance with different config props and it all falls into place nicely
@bonedfps
@bonedfps 23 күн бұрын
Hello there, I just came across your video on my youtube homepage. First up: nice video and great sound quality! Tho, I think the separation of concerns, that you are basically talking about, is great, it becomes increasingly harder when working with server components. Moving your data logic to a separate function is the right choice, but error handling is still pain, even if one goes after what you suggest. It still requires either catch callbacks or an error state field to be used, which in turn makes the code unclean again like it was from the get go. What is your opinion or way of working on that?
@profydev
@profydev 22 күн бұрын
That's a good question. I don't have a lot of experience with server components yet. Do you mean in the context of Next.js? Would be awesome if you could send some example code or a GitHub repository
@bonedfps
@bonedfps 19 күн бұрын
@@profydev Hey, yeah I meant in the context of Next, tho unfortunately the projects im working on are all closed source, so I can't share anything. What is common tho is to return an object in a server action, that represents the current state, e.g. "error" or "success", with the appropriate response data. In the frontend we'd have to check for that state in ugly ways, which is what I meant with that, in the end, it all becomes unclean again.
@milad8436
@milad8436 13 күн бұрын
Very helpful. Thank you
@gustavoeklund
@gustavoeklund 20 күн бұрын
I just came from KZbin home and these videos caused me a disease: I die if you stop posting them
@gamingxsvssdeva4245
@gamingxsvssdeva4245 6 күн бұрын
can you attach github repo for this project
@realTalhaMeer
@realTalhaMeer 18 күн бұрын
As per your implementation, you only return the data, that is being used in that component, what if an API is being used in two different components. Please explain or create a video on it. Thanks
@profydev
@profydev 18 күн бұрын
Actually the fetch function returns all the data from the endpoint but simply transforms it to isolate the components from the exact response data structures. Maybe this will become clearer in the next video where we introduce shared domain models
@realTalhaMeer
@realTalhaMeer 18 күн бұрын
make some clarity. it would be better if you address this part in the upcoming videos.
@NoName-bu5cj
@NoName-bu5cj 19 күн бұрын
wouldn't it be better to return a more generic object from api? say you decided you don't want your users to shout. you want them to whisper. you'll have to change the code inside both the component and the api. you could instead return a generic `data` property and inside the component name it whatever you want: ```js const { data: shouts } = API.getShouts() ```
@profydev
@profydev 19 күн бұрын
I think if the underlying entity changes you have to adjust a large chunk of the codebase anyway. But good point about the naming. It’s kind of like Twitter became X and Tweets became Posts, right? I’m wondering how many references to "tweet" are in the X/Twitter codebase 😂
The Story of React Query
8:55
uidotdev
Рет қаралды 58 М.
1 класс vs 11 класс (неаккуратность)
01:00
БЕРТ
Рет қаралды 4,8 МЛН
Can you beat this impossible game?
00:13
LOL
Рет қаралды 44 МЛН
Chips evolution !! 😔😔
00:23
Tibo InShape
Рет қаралды 42 МЛН
¡Puaj! No comas piruleta sucia, usa un gadget 😱 #herramienta
00:30
JOON Spanish
Рет қаралды 23 МЛН
I Was Wrong About React Router.
19:06
Theo - t3․gg
Рет қаралды 54 М.
How Neovim saved me at least 30 minutes today
8:12
Rasmus Bergström
Рет қаралды 5 М.
Fetching Data Doesn't Get Better Than This
6:58
Josh tried coding
Рет қаралды 59 М.
Refactoring a React component - Design Patterns
15:19
Cosden Solutions
Рет қаралды 88 М.
You don't need a frontend framework
15:45
Andrew Schmelyun
Рет қаралды 80 М.
MVVM vs. MVI - Understand the Difference Once and for All
18:40
Philipp Lackner
Рет қаралды 27 М.
How was this not in the browser before???
16:30
Theo - t3․gg
Рет қаралды 93 М.
“Act On Press” - John Carmack's Hot Take On UI
7:54
Theo - t3․gg
Рет қаралды 67 М.
1 класс vs 11 класс (неаккуратность)
01:00
БЕРТ
Рет қаралды 4,8 МЛН