re: 53 Things I Learned Writing a Multiplayer Strategy Game in Javascript and Python VIEW POST


Hello there Lina, nice job - getting your feet wet by diving into the project is the only way i know of that you can actually grow. I would like to point out a few somewhat wrong statements

7) Styling components inline is more manageable than using CSS in my opinion

In truth it seems more manageable because its easy but its not composable. You are redefining the same styles that you could reuse anywhere. I suggest you checkout styled-components which are the number one way to style stuff in react. Inline styles have their place but mostly for writing/overwriting specific css attributes.

10) Positioning a div in the middle of a screen isn't straightforward.

Aside fron the fact that you present a h1 tag :) - Its actually quite straight forward. You already mentioned flexbox so why not do this?

// html


// css
div {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  right: 0;
  display: flexbox;
  align-items: center;
  justify-content: center;

14) There are many ways to add animations in React. CSS is the best IMO - performance and simplicity

This statement is half wrong. CSS animations are actually slower than Javascript animations. Yes they might feel more complex than CSS animations. But javascript animations (given a nice library) are more powerful and flexible.

This is a nice read if you want to get technical (css-tricks.com/myth-busting-css-an...). See a library like react-spring which again is a favorite among developers for animations in react.

Other than that, thats a lot of learning good job :)


Thanks for the detailed feedback! On points 7 and 10, I heavily prefaced that this is just my opinion. Both statements are opinions that I don't present as fact. Tks about the div note, I updated my gist. The last comment, tks for the information. On 14, I looked at the link you sent across and it says that CSS vs Javascript performance is browser dependent and CSS is still faster in some cases, so I think that it is unfair to say that 'CSS animations are actually slower than Javascript' because that is not true either

code of conduct - report abuse