I Reviewed Your Beginner React Code

I Reviewed Your Beginner React Code

Josh tried coding

8 месяцев назад

99,359 Просмотров

Ссылки и html тэги не поддерживаются


Комментарии:

@kekw7793
@kekw7793 - 07.01.2024 21:13

As if recruiters would know what a commit is or gave a fuck about the commit conventions.

Ответить
@ChibiBlasphem
@ChibiBlasphem - 06.01.2024 08:56

Type at plural don't always come for arrays, for example component props types. What you find to want to be singular is mostly "entity" based types (like User, Product, etc)

Ответить
@dutchbozo
@dutchbozo - 04.01.2024 23:03

There is only one perfect solution for the mobile part. Put in the effort to make it responsive. This is especially needed when someone could look at your website on a smaller device (not supported seems sloppy for such a small scale application). Navigator.userAgent docs: "Browser identification based on detecting the user agent string is unreliable and is not recommended, as the user agent string is user configurable." With the changes in the video you could also potentially get a bug.

Ответить
@Dev-zg3nm
@Dev-zg3nm - 04.01.2024 04:49

Calling `useSytem` again from within TimeCategory will re-execute all of its code and hooks, creating new instances of all of the system's state/hooks local to TimeCategory. (despite destructuring only setLocalStorage)
This approach would only be valid if useSystem stored everything in a Context or will lead to problems for any props that depend on shared state.

Ответить
@asagiai4965
@asagiai4965 - 02.01.2024 19:58

Before we change something. we should know what we are changing. I think.
Example. (technically the reason result have s is because the person coding thinks the interface have a lot of members)
result here is an interface. by convention it should have capital I so shouldn't it be IResult?
IResult is very vague. If you look at the purpose. It is the user result. So maybe it should be IUserResult.

Extra advice or opinion Interface on most cases I think shouldn't be made plural. So no or don't use IUserResults.
Instead make the one referencing it the plural or something.
Ex.
(Singular)
const [userResult, setUserResult] = useState<IUserResult>(...)
(Plural)
const [userResults, setUserResults] = useState<IUserResult[]>(...)
(Another way of making it plural is)
const [userResultLists, setUserResultLists] = useState<IUserResult[]>(...)

Ответить
@panxel8615
@panxel8615 - 02.01.2024 03:00

1st one is literally just a monkey type clone bruh

Ответить
@InspireForward369
@InspireForward369 - 26.12.2023 18:47

I agree with the css change, lots of extra code removed for the actual non-mobile user

Ответить
@soheiljahangirie2477
@soheiljahangirie2477 - 22.12.2023 16:32

well your own code need code review by at least a senior dev

Ответить
@myke6972
@myke6972 - 22.12.2023 05:34

wait, so that's a beginner react code? I feel so down right now knowing that this is a beginner one 😂

Ответить
@sp3ctum
@sp3ctum - 21.12.2023 20:53

I think most of these make sense 👍🏻
If there's another project you review, maybe you could consider adding in a few words about testing. Even if this is a fun project for a resume, the author would probably still like to have (automatic) dependency updates. Having some tests is much better than nothing.

Looks like they wanted to have some tests but the only test file is empty.

Another thing I saw in the code is that the author could use "as const" to define some static configuration, although this is more of a curiosity than an actual useful suggestion in this case.

Nice project!

Ответить
@smohammadhn
@smohammadhn - 18.12.2023 23:09

disliked, I disagree with nearly 80% of what you said. the comments are clear.

Ответить
@HarshShah465
@HarshShah465 - 18.12.2023 21:24

Atomic hooks is very important point.

Ответить
@HarshShah465
@HarshShah465 - 18.12.2023 20:37

Only 90k subscribers. Really?

Ответить
@josephito27
@josephito27 - 17.12.2023 07:17

the way I see the custom hook for devices is like an excuse he/she made to just keep practicing some logic and react functionality in general, something that the "easier" way with a couple of css lines won't give you as a beginner, the tip you gave is alright I guess, not the best approach either lol, it looks more like a work around to me tbh.

Ответить
@ahshawon879
@ahshawon879 - 16.12.2023 22:56

Can't agree with all your improvements. :(

Ответить
@GeneralDeD9963
@GeneralDeD9963 - 16.12.2023 12:40

Thank you Josh

Ответить
@Exilum
@Exilum - 16.12.2023 04:04

My phone counts as large by your CSS implementation. In fact, it probably would count as 2xl. You wouldn't want to use device size to discriminate between mobile and PC. Especially when there is a such a variety of screen sizes between mobile and PC.

Ответить
@jame_sta
@jame_sta - 15.12.2023 10:04

React = 💩

Ответить
@YuriLifeLove
@YuriLifeLove - 15.12.2023 05:58

Some of my commit messages: \M/, devil, 666, FUN (.❛ ᴗ ❛.), hmm, (σ≧▽≦)σ

Ответить
@unknown-im8kj
@unknown-im8kj - 13.12.2023 21:16

style commit prefix its not about ui changes, it means codestyle changes

Ответить
@user-hb6yb6bu8n
@user-hb6yb6bu8n - 13.12.2023 17:57

Josh, I'm fetching on the server with trpc and mutating on the client, how do I revalidate data?

Ответить
@minhbaotran180
@minhbaotran180 - 13.12.2023 10:16

This is very helpful for new beginner like me. Thank you very much!!!

Ответить
@jayedeem
@jayedeem - 12.12.2023 05:32

chore: fix

Ответить
@lophixarts
@lophixarts - 09.12.2023 19:20

Would you recommend Angular 17 vs next.js?

Ответить
@DioArsya
@DioArsya - 09.12.2023 14:05

conditionally render by checking only the device width is too junior to become a review on code

Ответить
@godofwar8262
@godofwar8262 - 09.12.2023 07:40

Can anyone tell me any best way for commit

Ответить
@irfansaeedkhan7242
@irfansaeedkhan7242 - 08.12.2023 10:22

No body gives this in-depth knowledge and tips thanks for that

Ответить
@TheIpicon
@TheIpicon - 07.12.2023 02:33

beautiful video, but I would argue that making the game hide on small screen is bad considering why he did that in the first place.
you're hiding just on small screen which connects to a responsive design, he did that not because a phone is small (you can have tablets larger than your laptop screen), but because the tracking hook he used does not work without a keyboard (e.g. doesn't work on a digital one -mobile/laptop).

so by your approach, someone with a big enough tablet can reach this website and play the game even when he can't.
using mobile agent here is the right approach, but as you said hard coding the values and getting all the agents probably will take him a lot of time and he will some,
for that case he should use a library like `react-device-detect`(769k weekly downloads), which renders a view based on the browser's agent with agent sniffing.

Ответить
@BrianVanderbusch
@BrianVanderbusch - 07.12.2023 00:48

This wasnt a code review of React. This was a public shaming of someone who doesnt follow your specific conventions and style guides.

Ответить
@kyuss789
@kyuss789 - 06.12.2023 10:41

All these suggestions are “nitpicks” except for maybe the hook restructure.

As long as you commits aren’t “chore: wip” write whatever you want. It literally doesn’t matter. Most teams use PRs and squash so you never see the original commit msg

Width check for disabling stuff could be problematic runs the risk of disabling stuff when it shouldn’t.

The Results type is hold the Result’s just like if you had a Settings type that had language and dark mode etc, you wouldn’t call that type Setting? Also who cares? Find and replace is a thing if it’s meaning changed.

These are all extremely superficial things and worrying about these things is what keeps people as a beginner. Learn how to use hooks properly, how to do safer conditional render. Hell how to actually style things effectively is more important.

With AI starting to write a lot of code know what is bullshit and not is more valuable that how to name things.

Ответить
@ProgramWithErik
@ProgramWithErik - 06.12.2023 09:48

I like the improvements to commit messages. That's one of the first things we did on our small team, because everyone's commit messages and titles for PRs were so different. I wonder too, if showing that the project pushed PRs up instead of commiting direclty to main could show a level of profesionalism. Then someone could write more about the changes they were making, even if they were the only person on the project.

I also wonder if the original intention of the one big hook in the main App.tsx file was about setting up a container/presentational component pattern. By adding all the logic into the App.tsx all the child components are presentational, and can be more easily tested, and updated, with limited mocking. I agree though, splitting up the hook makes sense.

Ответить
@asadsiddique5527
@asadsiddique5527 - 06.12.2023 09:26

🤓🤓🤓🤓

Ответить
@gmusic8812
@gmusic8812 - 06.12.2023 08:29

The first one was Monkey Type right? since it is open source.

Ответить
@free2idol1
@free2idol1 - 06.12.2023 06:17

commitLint and the Excalidraw app is new and very helpful to me. Thank you, Josh!

Ответить
@JayD1994
@JayD1994 - 05.12.2023 21:57

I edge to your videos

Ответить
@mikelCold
@mikelCold - 05.12.2023 11:39

Anyone who cares about commit messages should be fired immediatly

Ответить
@nonybright1514
@nonybright1514 - 05.12.2023 10:56

Removing whitespace should fall under style and not refactor since it doesn't necessarily change the meaning of the code.

Ответить
@rinotovar327
@rinotovar327 - 04.12.2023 22:41

More of this please!

Ответить
@genshian
@genshian - 04.12.2023 20:44

Make more of these!!

Ответить
@pmsanthosh
@pmsanthosh - 04.12.2023 15:01

Someone just forked monketype and shared it 🤣🤣

Ответить
@griffadev
@griffadev - 04.12.2023 13:23

Style conventional commit message is for code style not styling in the UI sense

Ответить
@oshawastaken
@oshawastaken - 04.12.2023 12:00

commitlint conventions were super helpful did not know about that

Ответить
@nixoncode
@nixoncode - 04.12.2023 10:59

wow! this was really useful, as someone who's been a back-end developer for so long now trying to get into react, am just learning a lot.

how do i submit my front-end projects for review?

Ответить
@twenteen510
@twenteen510 - 04.12.2023 10:15

If this code is written by a beginner then who am I 😂?

Ответить
@giannisnik5295
@giannisnik5295 - 04.12.2023 10:12

Git commits often involves different changes in code so you can't specify the exact change.I personally use "1:commit" and so on....

Ответить
@anc9523
@anc9523 - 04.12.2023 08:18

Is that a joke when he did a whole hook to detect mobile version for optimization and you just tell him to hide it with css 😢😢 ?

Ответить