Best React Folder Structures | Beginner - Intermediate - Advanced

Поделиться
HTML-код
  • Опубликовано: 30 ноя 2024

Комментарии • 155

  • @mfpears
    @mfpears 2 года назад +60

    Never organize by the tool you're using (enum, interface, redux). Things that change together should be next to each other. You don't want to be in 4 completely different places in the folder tree every time you touch a feature. What do you change more: Reducers for all features, or reducers and components for a single feature? This is why React has single-file components. People never learned from AngularJS.

    • @Simon-rq7sx
      @Simon-rq7sx 2 года назад +2

      Check the feature-sliced design, I use some patterns from it in my angular projects for example slicing components folder on entities, features, pages and always keeping everything near the feature. Cool thing

    • @ponderatulify
      @ponderatulify 2 года назад +1

      I came here to say exact this. Great thing he shared, because you commented. Now we all learned :D

    • @PedroTechnologies
      @PedroTechnologies  2 года назад +4

      I appreciate ur comment because it gives a different perspective to the topic :) Like i mentioned, there is no exact answer, specially cause every project/developer is different. When i made this video (a year ago), i was using my dev experience at my first 2 jobs as a basis. Both followed similar structures as i showed in the video. Now, i think more aligned to what u mentioned in ur comment! But like i said, both options are equally correct, it depends on how u and ur team like to code.

    • @willmesko
      @willmesko 2 года назад

      @@PedroTechnologies vertical slice became popular in big react applications, separating the project into modules based on ddd

  • @yoku_UwU
    @yoku_UwU 2 года назад +3

    I didn't expect someone to have a video on *exactly* what I wanted to know. Thanks!

  • @Sebasuraa
    @Sebasuraa 2 года назад +50

    1:00 beginner
    3:30 intermediate
    13:54 advanced

  • @anthonydushaj6155
    @anthonydushaj6155 3 года назад +18

    Images are technically supposed to go into the public folder that comes with create react app . They can be accessed there easily

    • @josephgarronegj
      @josephgarronegj 2 года назад +1

      Not true anymore

    • @anthonyagbator8584
      @anthonyagbator8584 2 года назад +1

      images in the public folder her quite heavy because they are by-passed and not compressed by react

  • @水果饭子
    @水果饭子 2 года назад +3

    Thanks learned a lot. The more folders, the better the technology

  • @mmsrp
    @mmsrp 2 года назад +8

    First, congratulations for the video.
    For the next level, react *expert* you should explain the folder structure with patterns like HOC and Provider. Micro-frontends folder structure differences, differences between folders structures with different state managements and stuff like that should be good too.

  • @jorgebarrero
    @jorgebarrero 2 года назад +3

    Very good video. I would just add... I am new to react, angular is the must I use, but I usually think that structural organization should be present at the root and top levels, and functional organization from the third or forth level. That means that root is just for configuration of the technologies used (docker, git, typescript...etc). Inside src usually I have two folders ans some loose files to configure the application. Inside src I always add two folders shared (for shared things like assets, shared components,, shared styles... etc) and layout that contains all functionalities to be exposed and visible to the user. From then on every folder is functional, that means it holds multiple types of things that serve to a single functionality. Than means that file distribution may change, but as a rules of thumb, functionalities are always in a folder with a name that explain what they do (not what they are as in structural design). On the structural philosophy, things are groped by file type, in the functional they are grouped because they are part of the same functionality). If you have many functionalities that do similar things, they are grouped (pages, services, etc), If they are global are in the shared folder, if not, they are in the layout folder. As you say... this is just an opinion.

  • @MrYuridaPaz
    @MrYuridaPaz 3 года назад +12

    Cai e para-quedas aqui nesse vídeo e adorei a forma como você explicou como organizar um projeto no React.
    Já me inscrevi no seu canal para aprender mais sobre React. Vi que no seu linkedin você foi instrutor de React e isso só trouxe mais confiança para assistir e acompanhar seus vídeos aqui. Parabéns pela jornada.
    Meu sonho é me tornar um ótimo programador e me mudar para o Canadá.
    Forte abraço.

    • @estudandocomoroger
      @estudandocomoroger 2 года назад +1

      Eu sou também sou BR e gosto muito dos videos do @PedroTech. Continue estudando bastante que com certeza vc vai realizar seu sonho de ir morar no Canada!!! Força irmão :)

  • @thewpwing
    @thewpwing 2 года назад +4

    Great explanation. I am transitioning from beginner to intermediate, and this helps me a lot. Thanks again.

  • @robertcarsten3127
    @robertcarsten3127 2 года назад +1

    The comment on using typescript is spot on.
    Recently did a vanilla JS project after years of Typescript and the amount of typos and other simple things typescript would call out immediately was really terrible.
    Can never go back now

  • @Thithe_dev
    @Thithe_dev 2 года назад +2

    Hey, Pedro. Hope you doing well. Just passed by to say thank you for your work here on RUclips. Maybe you have no idea about how much they help people that are just starting out with React. Big hug, and keep up the amazing work 💯

  • @tinotaylor
    @tinotaylor 2 года назад

    A simple topic one that is very much needed.

  • @alexanderzharkov6953
    @alexanderzharkov6953 2 года назад +1

    This is truly Invaluable content

  • @Brocollipy
    @Brocollipy Год назад

    Thanks so much, really helpful stuff. As you say there’s definitely a lack of this type of info. 👌🏻

  • @OTadashi162
    @OTadashi162 2 года назад

    Thanks for the explanation, my current project is so messy that I not even want to open it anymore...
    I will put some of your suggestion in use

  • @varaprasad4163
    @varaprasad4163 3 года назад +5

    Here comes the Guru! Thanks a lot, brother. such amazing content. looking forward to your AWS Lamda video.

    • @PedroTechnologies
      @PedroTechnologies  3 года назад +1

      Glad you are liking the videos! I am still learning more about AWS hahaha should make it as soon as I feel ready

  • @MrFyce
    @MrFyce 3 года назад +5

    Could you create a tutorial on building a react app. Basically something like CRUD but you display information in the form of a table and you can edit and delete each row.

  • @MaltonCanada
    @MaltonCanada 3 года назад +1

    You can use example like => import Navbar "../../../Navbar"

  • @carlitosmo
    @carlitosmo 3 года назад +2

    Long time ago I searched for a video as yours

  • @Lunolux
    @Lunolux 2 года назад

    Great vide0, and those 3 last minutes was gold advice, thx

  • @ondifrans3283
    @ondifrans3283 3 года назад +2

    who tf dare to unlike ur vids?! like, u r too damn coooooll buddy!!

  • @lokmanlife3023
    @lokmanlife3023 3 года назад +3

    Commenting while watching..
    1)damn.. beginner to intermediate was a big jump..
    2)the pages, can you make a vid explain in depth about it?
    3)Tutorial on Redux, Redux toolkits, Redux-Thung, React-redux..
    4)Tutorial on Docker..
    5)Tutorial on TypeScript and how to use it.. I saw it can be use on the frontend and the backend.. not really sure how to use it..
    Thx as always for the vid..

    • @PedroTechnologies
      @PedroTechnologies  3 года назад +2

      1) Hahaha yeah it is. I think its harder to go from beginner to intermediate than intermediate to advanced.
      2) Yeah, but its just the routes. For example, when you have a home page, a login page, a profile page. I just put them in the pages folder.
      3) I don't use redux hahaha but maybe I will learn it and make some videos on it :)
      4) Planning on it ;)
      5) I have some tutorials on it, but will definitely make more!

    • @boyefrederic4716
      @boyefrederic4716 3 года назад

      @@PedroTechnologies Have you any particular reason to not use Redux, can you share your thought
      about it

  • @nasserhossam1
    @nasserhossam1 3 года назад +1

    Very very good, smart and straight to the point. I was really looking for a short video ! Thanks👏👏👏

  • @ruchirabharadwaj
    @ruchirabharadwaj 3 года назад +2

    Thanks a lot brother, was waiting for this

  • @ahlan3609
    @ahlan3609 3 года назад

    @PedroTech You said your goal was to hit 30k over the summer and you weren't sure it was possible. Either way you are at 37k now so good job man you deserve it!!

  • @meta-web-school
    @meta-web-school 2 года назад +1

    Thanks , Thanks. It's very Important .. 🔥❤️

  • @anton290398
    @anton290398 2 года назад +1

    For the advanced I'd also recommend looking into atomic design (atomic methodology), i think it provides a very nice structure for the components and components interacting with other components.
    Also, for advanced + TS I'd recommend structuring your componets into folders (folder per component) and working of of index.tsx styles.ts interface.ts file structure for each of these component folders. It helps you keep things much more organised and removes the need to look into multiple different places to work on one bit of the UI. The interfaces folder then is only for generic stuff (api responses, constant types and so on).

    • @NathanHedglin
      @NathanHedglin 2 года назад +1

      This ^. I'm doing this for a client project and it has worked out wonderfully. Develop is extremely efficient and fast. Love TS

  • @blueb06
    @blueb06 2 года назад

    Damnn....u just teach different ly....and I love to learn different ly...whatta match ! Thank you ❤️

  • @tekkel06
    @tekkel06 3 года назад

    Exactly the channel I was looking for. Liked & subscribed !

  • @senioranalyst6337
    @senioranalyst6337 3 года назад

    wow Pedro, u are the one of the best react instructors, i really appreciate

  • @divyarajsinhrana6045
    @divyarajsinhrana6045 2 года назад

    Well explained!! Great work🙏

  • @manuxgp
    @manuxgp 3 года назад +3

    Do you have a tutorial on testing in react?

  • @zephyrus21
    @zephyrus21 3 года назад +1

    Awesome video!!! In need of this... Thanks

  • @count_of_pizza
    @count_of_pizza 3 года назад +3

    Thx! Consider adding tutorial about Redux structure ;)

    • @PedroTechnologies
      @PedroTechnologies  3 года назад

      Glad you liked it! I am not very experienced with redux so I don't know if I could make such video.

    • @mwnkt
      @mwnkt 3 года назад

      @@PedroTechnologies If you do not use Redux, what do you use for state management , my friends use Redux but I find it difficult to learn , could you do a video on what state management system you use ?

  • @thecodebranch159
    @thecodebranch159 2 года назад +1

    Keep pushing 💥

  • @CaliburPANDAs
    @CaliburPANDAs 2 года назад +1

    noob question but what should go inside the public folder? thanks

  • @wralith
    @wralith 2 года назад

    It is exactly the content i've been looking for. Would you suggest exactly the same pattern for Next too?

  • @josephcoyle8126
    @josephcoyle8126 2 года назад

    Thank you for this video--I appreciate the honesty at the end, indeed every project is unique and the developers in the end can make the best judgment call. Videos like this are definitely helpful for getting there though.

  • @Kunal-jp8tn
    @Kunal-jp8tn 2 года назад +1

    Thank you so much for this video.

  • @joaovictor-dl6ve
    @joaovictor-dl6ve 2 года назад +1

    The helpers folder is the same like the utils folder?

  • @drewtrades265
    @drewtrades265 3 года назад

    Good stuff man. Super helpful reference as I’m spinning up my first react app.

  • @antochitic
    @antochitic 3 года назад +1

    I like this kind of content! Quality: 👍

  • @saidmaroc8448
    @saidmaroc8448 3 года назад +2

    Thank you very much Pedro for sharing,
    however, when is the training on typescript :)

  • @cosanostraytc1030
    @cosanostraytc1030 2 года назад

    Good work man keep it up!!!

  • @hatemmohamed8172
    @hatemmohamed8172 2 года назад

    Thank you man for sharing your experience it really helps a lot ❤❤

  • @fhkodama
    @fhkodama 2 года назад +1

    Hey Pedro! Great video, thanks for that! I still have a question about this subject. What about the backend? Should we create a separate folder like backend or server? Do you have a folder structure suggestion for an App including frontend and backend?

  • @muzika5001
    @muzika5001 2 года назад

    Hi Pedro, Do you have video how to configure your own boilerplate?

  • @137dylan
    @137dylan 3 года назад +1

    You mention you don't use Redux - what do you use instead? I was under the impression it was necessary for larger scale projects. Thanks

    • @marcoonlinetv7769
      @marcoonlinetv7769 3 года назад +2

      useContext + useReducer pattern .It is kind like Redux, but easier to work and you do not need to install anything !

    • @137dylan
      @137dylan 3 года назад

      @@marcoonlinetv7769 Yes I've used the context API in my React projects to date, which has been fine for those smaller projects. My understanding (impression) was if you want to become a mid/senior level React JS developer, using and knowing Redux was essential as many companies use it.

    • @marcoonlinetv7769
      @marcoonlinetv7769 3 года назад

      @@137dylan I do not speaking about context.api. But context with reducers. This is future and redux is in slow decline

    • @jsceo
      @jsceo 3 года назад

      @@137dylan being senior is not about knowing redux, but rather than being able to learn new library in one weekend, it doesn't matter if is it redux, recoil, mobx or zustand, really

    • @MarlonEnglemam
      @MarlonEnglemam 3 года назад +1

      nowadays context with useReducer does the job that years before you could only achieve with redux or smth. I tend to avoid redux as much as I can, too.

  • @kzar123
    @kzar123 3 года назад

    Excelente vídeo bro. Subscribed

  • @TheNamesJT
    @TheNamesJT 3 года назад

    Redux us kinda a pain in the ass but can see the use in it when it comes to managing a huge project with tons of state

  • @farban6200
    @farban6200 3 года назад +1

    can you make a video like this for the backend side?

    • @PedroTechnologies
      @PedroTechnologies  3 года назад +1

      Here it is: ruclips.net/video/oNlMrpnUSFE/видео.html

  • @heatherherries9359
    @heatherherries9359 2 года назад

    So question on the intermediate version, I see u have included your css file in with your pages so would you style your components in there as well?

  • @gilmoretj
    @gilmoretj 2 года назад +1

    Whilst not the main topic of this video I have to take issue with your statement regarding who prepares tests and at where level. Software engineers and test engineers bring very different mindsets to the development process, and all for the better of the product. Of course, on smaller teams these two roles are often performed by the same person but at different times.
    That does not mean developers on larger teams have no responsibility for testing, whatever level. Your (ancillary) comment that only senior developers need be concerned with writing tests is completely incorrect although I would limit their responsibility to unit testing. I am firmly of the opinion that no code can be called complete and fit for purpose without unit tests to prove it and the construction of such tests is the responsibility of the developer, irrespective if TDD was employed or not.

    • @PedroTechnologies
      @PedroTechnologies  2 года назад

      I understand ur point, but I respectfully disagree! I feel like there is a disconnect from very smart programmers to the rest of the coding community. Most programmers will find it EXTREMELY hard in the beginning, and a good amount of them will give up. My channel and videos are meant to help beginners move past this and start enjoying the process of learning. If I sat here and told them that they had to start testing since the beginning, I would be ignoring the struggle I went through when professors/courses told me the same. In my opinion, testing is not as important as finding your love/joy in programming, and it can easily be a burden if done right in the beginning. It does set good standards, but it doesn't matter if eventually the people learning will lose motivation and stop coding. In my opinion, testing comes later on in the journey, not when u are a senior dev, but when u start building stuff that will be used by other people (like an entry level job or a startup u are starting). Code doesn't need to have tests to be complete, code is code. Just because someone wrote bad code it doesn't mean it's not code. Also, I don't believe TDD is necessary for everyone, I personally leave my tests to the end of each component group/feature I add and it works great! This is an awesome topic to discuss :) I appreciate ur feedback!

  • @somebody-17546
    @somebody-17546 2 года назад

    what about features folder . I read redux document and they write : "We specifically recommend organizing your logic into "feature folders", with all the Redux logic for a given feature in a single "slice/ducks" file".

  • @petradf7844
    @petradf7844 3 года назад

    Thank you so much Master Pedro

  • @levyroth
    @levyroth 3 года назад +1

    Woop woop! This is great content dude!

  • @drewbregman9098
    @drewbregman9098 3 года назад +1

    Great video; subscribed.

  • @aashish_stanl
    @aashish_stanl 9 месяцев назад

    Hey, thank you so much for the video. I am checking on how to add the authentication in React. can you share the link in a comment if you have any video containing it please?

  • @Sebasuraa
    @Sebasuraa 2 года назад +1

    Why do you use caps on folder names? (Auth instead of auth, Components intead of components, etc)

    • @PedroTechnologies
      @PedroTechnologies  2 года назад

      It is just a preference, some people like to have files with caps and folders with lower. I like both :)

  • @ballonura
    @ballonura 3 года назад +2

    No Ep.17 of "Full Stack Web Development Course"? :(

    • @PedroTechnologies
      @PedroTechnologies  3 года назад

      Sorry about that hahaha I planned on posting the last ep tuesday. But since it is a deployment video, I want to set up everything and prepare prior to it in order for the video to have the least amoutnt of mistakes possible (deployment is really annoying hahaha). And bc I was overwhelmed with work from my job, I couldn't finish recording it monday or tuesday, so I made this quick video since a lot of you asked. Next video is the last ep of the series!

    • @ballonura
      @ballonura 3 года назад

      @@PedroTechnologies Thx man, we appreciate the hard wor!

  • @saura_
    @saura_ 2 года назад

    So, is not a good practise to declare props' interface in the same component if we don't need to export them? E.g. if I have a card componente with title, body and function in props, would you put this props in Interface folder too?

  • @dgcp354
    @dgcp354 3 года назад +1

    How is it GOing, friend

  • @Pouetpouets
    @Pouetpouets 3 года назад

    Nice tutorials, thanks for the tips !

  • @ThColinPereira
    @ThColinPereira 3 года назад

    Thanks for the amazing content Pedro

  • @catalystgaming4878
    @catalystgaming4878 2 года назад

    Hi! Thanks for your video. Very helpful. I'd like to ask which folder we put the file for consuming web apis? Is it inside the services folder, like /services/apiCustomer.ts?

  • @NatsukosKitchen
    @NatsukosKitchen 2 года назад +1

    surely beginners should be learning about testing as early as possible? 1.53 'no beginner will write tests...'

    • @PedroTechnologies
      @PedroTechnologies  2 года назад

      I disagree! Although testing is very important, it is mostly important later on in their dev journey (closer to when you are applying for jobs). Thousands of beginners give up when they start because they get scared, so making them write tests would only make them more scared. I learned testing 1 or 2 months before getting my first react job (so like 5 months after I started learning it), and never had issues with it. But everybody is different, so it depends on the person :)

  • @DamjanDimitrioski
    @DamjanDimitrioski 2 года назад

    With typescript you use 90% of the development time to guess the type, create types, find typings for your libraries, unlike the native js alternative where you just focus on going forward.

  • @ec9386
    @ec9386 2 года назад

    Is it best practice to name the folder start with uppercase or lowercase?
    I occasionally see others name it start with lowercases.

  • @asdfasdfasdfasdf219
    @asdfasdfasdfasdf219 3 года назад

    Nice Video! Do you have one with hexagonal architecture either just the front-end or back-end project?

  • @shivshankar654
    @shivshankar654 2 года назад

    Bro make video on react context fetching api. Two crud in single project

  • @creativeartdesign4820
    @creativeartdesign4820 2 года назад

    maybe you should rename Pages to Containers.. better understanding?

  • @vaideshshankar9899
    @vaideshshankar9899 3 года назад +2

    How do you manage larger states within your application if you don't use redux? I was curious to explore some alternatives.
    Btw the content is great. Keep going 👍

    • @sam974fe
      @sam974fe 3 года назад +5

      you can use context or react recoil

  • @vladimirpuma6079
    @vladimirpuma6079 2 года назад

    What could i use instead of interfaces if i work with js

  • @gody1305
    @gody1305 2 года назад

    Great content 🗯

  • @chilly2171
    @chilly2171 3 года назад

    What about the backend portion? Where do you store those?

  • @ahmedalaaezzat
    @ahmedalaaezzat 3 года назад

    Thank you for sharing that :)

  • @arifulInsight
    @arifulInsight 2 года назад

    Hey! Thanks for your effort... By the way how I can interaction with Pages components. I mean when u import all file in index.js file in Pages folder then how can i show my content on website. Thank in advance

  • @kunaltiwari3118
    @kunaltiwari3118 3 года назад +3

    I wanted this...

    • @PedroTechnologies
      @PedroTechnologies  3 года назад +1

      Hope you enjoy it!

    • @kunaltiwari3118
      @kunaltiwari3118 3 года назад +1

      @@PedroTechnologies Yes project structure is very important and best Project structure helps in testing, development as well as it's easy to maintain

  • @jalalbmnf
    @jalalbmnf 3 года назад

    Hi,thank you for great video. Which icon extension for files ?

  • @VeeWebCode
    @VeeWebCode 2 года назад

    what you use if you don't use redux?

  • @BeckasinMC
    @BeckasinMC 3 года назад +1

    Pedro de donde sos?

  • @BusinessWolf1
    @BusinessWolf1 2 года назад

    I don't think there's any point in writing tests for a small react application, especially if no one else is gonna see/use it

  • @TheNamesJT
    @TheNamesJT 3 года назад

    Where would you put your endpoints like your api?

    • @Antebios
      @Antebios 3 года назад

      That should go into another project, like a backend project using nodejs, express, and whatever db (usually mongodb).

  • @ossamaelidrissi2624
    @ossamaelidrissi2624 3 года назад +1

    thanks you from Morroco

  • @gorimor
    @gorimor 3 года назад

    Out of curiosity what do you use instead of Redux?

  • @bulldog2024
    @bulldog2024 3 года назад

    Does it matter if folder names are capitalized or not?

  • @ayushlal2370
    @ayushlal2370 3 года назад +2

    Should we keep our folders with a capitial starting letter? I noticed that in your intermediate example you had the initial letter capitalised on the folder (e.g. Helpers) but in the advanced example it was the opposite (e.g. helpers). Does it matter or is it preference based?

    • @SanjayKumar-un7xf
      @SanjayKumar-un7xf 3 года назад

      Please read about PSR concept then you will get your answer :)

  • @ralexand56
    @ralexand56 2 года назад

    I don't believe you can have react files with jsx named with a .ts extension.

  • @JayPatel-pq5fp
    @JayPatel-pq5fp 2 года назад

    Share your eslint settings

  • @Y2hlc3Rlcg
    @Y2hlc3Rlcg 3 года назад

    big thanks!

  • @micha8617
    @micha8617 3 года назад

    great thank you!

  • @VivekShharmaa
    @VivekShharmaa Год назад

    @PedroTech Hi, This is Vivek Sharma. I want this folder structure can you give me the link.

  • @saadowain3511
    @saadowain3511 3 года назад +1

    You are awesome

  • @ShahriarShafin
    @ShahriarShafin 3 года назад

    Thank a lot.

  • @khraken3518
    @khraken3518 3 года назад +2

    Am i the only one which hate capital letter on projects files and folders ?

    • @PedroTechnologies
      @PedroTechnologies  3 года назад +1

      I dislike it too hahaha but I knew a lot of beginners do this so thats why i did this for the beginner and intermediate.

  • @takbeeralikhan1043
    @takbeeralikhan1043 3 года назад

    very helpful for me

  • @poletto__
    @poletto__ 2 года назад +1

    Pedro, você é Brasileiro?

    • @PedroTechnologies
      @PedroTechnologies  2 года назад +1

      Meu sotaque entrega demais kkkkkkk

    • @poletto__
      @poletto__ 2 года назад

      @@PedroTechnologies Kakakakaka desconfiei desde o início, conteúdo bom demais, vídeos em inglês parecem mais técnicos por algum motivo.

  • @sai7743
    @sai7743 3 года назад

    Hi bro I need an API integration login on reactjs

  • @Svyatoslav-w2t
    @Svyatoslav-w2t 2 года назад

    Thank u😍

  • @melfordbirakor
    @melfordbirakor 3 года назад

    Thanks