Why Did They Do This?! (Code Review)

แชร์
ฝัง
  • เผยแพร่เมื่อ 30 ก.ย. 2024
  • Join The Discord! → discord.cosden...
    VSCode Theme | Font → Material Theme Darker | Menlo, Monaco "monospace"
    Welcome to Code Review!
    This is a series of videos where I review code that you send me or that I find online. I review the code as I would when I work with my clients. You will see how a senior developer looks and thinks about code in a variety of scenarios, learn about best practices and how to do things the right way, and learn how to become a better developer overall.
    Enjoy!
    Darius

ความคิดเห็น • 29

  • @yannickbonavoglia2448
    @yannickbonavoglia2448 7 หลายเดือนก่อน +15

    Thanks a lot for reviewing my code! I really hope it also helps others.
    The section of the code you reviewed was actually written months ago and I totally agree that everything should be separated in its own logic.
    The main reason why I didn’t put it in the first place is that when I realized it I already had written too much code and I was too lazy to refactor it 😅
    Keep up the good work!

  • @tofahub
    @tofahub 7 หลายเดือนก่อน +3

    I am porting from Angular and best react channel I have found thus far. I don't wanna make a todo app as an advanced programmer. I wanna learn best practices and this is the channel for that

  • @imkir4n
    @imkir4n 7 หลายเดือนก่อน +6

    Keep it coming, i love this series

  • @julienraillard3567
    @julienraillard3567 7 หลายเดือนก่อน

    How would you handle the post summaries buttons to be recalculated when the comments are edited (number of like for the post, number of commentaries, etc.)? would you pass such a callback fonction down to the PostCommentCard components or something else ?

  • @Solo_playz
    @Solo_playz 4 หลายเดือนก่อน

    Great video 👏🏼
    Can you review my codebase?
    How can I send you the code repo link?
    Believe me the code I've written is really good enough that can be used in your content I just wanted that a senior developer like you can review my code and suggest me more good ways to optimise and restructure the entire code base ❤

  • @keatonaylor1580
    @keatonaylor1580 7 หลายเดือนก่อน +3

    digging the content thanks!

  • @omnilothar
    @omnilothar 7 หลายเดือนก่อน +1

    if a component has too many useState (let say 5 or more), would you recommend to use reducer instead?

  • @toastrecon
    @toastrecon 4 หลายเดือนก่อน

    Seriously one of the best React channels on YT.

  • @davronmaxmudov3972
    @davronmaxmudov3972 7 หลายเดือนก่อน +1

    I download, like, share without watching). Your content is super cool

  • @cedericprivat
    @cedericprivat 6 หลายเดือนก่อน

    I would love to see a video in which you explain how to handle state in a bigger application that has a lot of nested components. I‘m struggling to figure out where to put state or context if I need to access it in multiple places.

    • @cosdensolutions
      @cosdensolutions  6 หลายเดือนก่อน +1

      Yep, have a video coming on complex state!

  • @larsfaye292
    @larsfaye292 7 หลายเดือนก่อน

    Really grown to love this channel. Feels like it's perfectly suited to my skill level. Intermediate enough where I can still learn new things, but not too advanced where I feel lost.

  • @DavideFicano
    @DavideFicano 7 หลายเดือนก่อน +1

    Too many "as" in this code...

  • @reencedavid1039
    @reencedavid1039 7 หลายเดือนก่อน

    Awesome content, keep it up! and always share the best standard of writing a react application.

  • @yunusyavuz4683
    @yunusyavuz4683 7 หลายเดือนก่อน

    I love this series, but I have a question. is not it a good approach that PostCommentCard have "memo" function. In this way, we should not pass the comment object directly, we should pass comment properties one by one as interface seggregation requires. So that, if the comments state has some changes, the whole cards will not rendered right?

    • @cosdensolutions
      @cosdensolutions  7 หลายเดือนก่อน +1

      Since PostCommentCard is pure UI, it's not worth it. Re-renders are cheap and shouldn't be a problem. Only memoize like that when you are rendering heavy components

    • @mohamedsalimbensalem6118
      @mohamedsalimbensalem6118 7 หลายเดือนก่อน

      ​​@@cosdensolutions so memoing a component isnt always good?

  • @richardantao3249
    @richardantao3249 7 หลายเดือนก่อน

    The comments are probably stored on the current post @ 7:20 because of the data from the database being denormalized. Any document based databases (and more) will have denormalized data, which makes reads easiers and writes harder. That is an inherent tradeoff of denormalizing data and you wouldn't be able to judge the design decision just by looking at the frontend code.
    EDIT: Confirmed: the data has a '_id' prop which is a feature of MongoDB, which is a non-relational document database

    • @yannickbonavoglia2448
      @yannickbonavoglia2448 7 หลายเดือนก่อน +1

      hey there, I’m the author of that codebase.
      On the backend (node) the single post has as the comments an array of ObjectIds (as a foreign key of a comment entity), when I fetch the post i use the .populate() method to get all the data related to that comment and store it in the array.
      I feel like the BE approach is correct as the data is separately stored and only referenced as a foreign key in the comments, on the FE the approach of separating the logics into its own component is completely right imo.
      Feel free to provide any feedback!

    • @richardantao3249
      @richardantao3249 7 หลายเดือนก่อน

      @@yannickbonavoglia2448 Hi! No issue with a separate component, just highlighting that certain tools and design decisions will influence your data to take a certain shape, and it’s difficult to judge the decision when the only context is a single (set) of react component(s).

  • @abdullahmanafikhi4438
    @abdullahmanafikhi4438 7 หลายเดือนก่อน

    You're awsome man !, thanks alot ❤

  • @hahaheheh0h0
    @hahaheheh0h0 7 หลายเดือนก่อน

    why do you not use vim/neovim when you're already using vim motions?

    • @cosdensolutions
      @cosdensolutions  7 หลายเดือนก่อน +1

      because I prefer the VSCode ecosystem

  • @nathnaelwondisha6649
    @nathnaelwondisha6649 7 หลายเดือนก่อน

    can you share the code

  • @virochansharma6446
    @virochansharma6446 7 หลายเดือนก่อน

    Vs code theme?

  • @shahidshafi1227
    @shahidshafi1227 7 หลายเดือนก่อน

    Theme??