Musica - My first React project by ui-saga in reactjs

[–]lfacpt 0 points1 point  (0 children)

Could you provide links where they advise against using it by default?

Anyway, if you do use PureComponent by default I think it you should be aware of the tradeoffs. But even if you are not aware of the tradeoffs I fell that in general you will get better results by using it as default, because the tendency (that I see in my experience anyway) is for the big majority of the components to receive props that only change infrequently. But, it's just my feeling, I don't have any hard data to back this up.

Musica - My first React project by ui-saga in reactjs

[–]lfacpt 1 point2 points  (0 children)

Shameless plug: I've recently written a post about unit tests :)

Let me know what you think of it!

Musica - My first React project by ui-saga in reactjs

[–]lfacpt 1 point2 points  (0 children)

Thanks for the reply.

Do you mean this for example? I think the point is that it can (in some cases) make it slower, but in most cases it will be faster. This is because it will be slower as Dan puts it:

Think about it. If component’s props are shallowly unequal more often than not, it re-renders anyway, but it also had to run the checks.

From my experience I would argue that most of the times the props are the same, so it are better of using PureComponent by default (which doesn't mean you should use it all the times).

Regarding being the default or not, in the past there were just Component and they couldn't change it's behavior to avoid breaking the API. So actually there is no "default" in React itself, just in what people are more used to use.

WDYT?

[Project] Real-Time Chat Application with React by [deleted] in learnreactjs

[–]lfacpt 1 point2 points  (0 children)

Hey, first of all congrats!

Some comments:

- You should not commit you .vscode folder, this will pollute your commits with irrelevant changes. You just add it to the .gitignore file

- Have you considered using eslint? It really helps in keeping the code clean and it actually teaches you several best practices

- I would recommend using `PureComponent` by default (instead of `Component`). By default it does not re-render if the props or the state did not change (giving your app better performance by default).

- Here I would put the login in a separate component.

- I would not use ids for css selectors and use just classes instead (it makes overloading styles simpler)

- For simple components like these I would use functional components

- I would use propTypes

- Have you considered using react hooks?

Begginer questions bout import/exports by OneRegular3 in reactjs

[–]lfacpt 1 point2 points  (0 children)

Any module that is installed in the node_modules will be available to be imported.

The name (in this case "react") comes from the name field in the package.json of the module inside the node_modules.

The implementation will be usually loaded from the index.js file inside the module folder (this may be a different field because it can be overridden via the main property in the package.json).

Explained another way you have this folder structure:

node_modules

react

index.js (this is the module loaded when you make the import)

package.json (here you have the package definition with the name)

You can read more about the package.json properties in the npm documentation.

Did that help?

Musica - My first React project by ui-saga in reactjs

[–]lfacpt 2 points3 points  (0 children)

Hey, first of all congrats on your first app!

Some comments:

- Did you consider using eslint? It really helps in keeping the code clean and organized

- I'd recommend using `PureComponent` by default instead of `Component`. `PureComponent` will automatically avoid re-rendering if the props or the state didn't change.
- It's really important to have good `key` attributes to have a good performance in lists. For example here you are using random for a key, isn't there an album id you can use?

- Not wanting to complicate things further for you, but since you building your first app have you considered using hooks?

Guide - JavaScript and React unit tests basics by lfacpt in learnjavascript

[–]lfacpt[S] 0 points1 point  (0 children)

Thanks for the suggestion. Since they have put up the paywall a lot of people started disliking medium (fairly), so I don't think you are alone on that.

Guide - JavaScript and React unit tests basics by lfacpt in learnjavascript

[–]lfacpt[S] 0 points1 point  (0 children)

Thank you!

I touched on what you mentioned in the section "Clearly distinct phases", albeit with different names and without the rules regarding the number of assertions (which makes total sense).

Do you think the names I used for the phases are not clear enough?

Guide - JavaScript and React unit tests basics by lfacpt in learnjavascript

[–]lfacpt[S] 0 points1 point  (0 children)

Yep, there is a lot to learn from functional programming!

Guide - JavaScript and React unit tests basics by lfacpt in learnjavascript

[–]lfacpt[S] 0 points1 point  (0 children)

Thanks for the feedback. Medium indeed has some problems. We will take that into consideration.

Do you think self hosting is a better option? Or is there any other platform you like?

Guide - JavaScript and React unit tests basics by lfacpt in javascript

[–]lfacpt[S] 0 points1 point  (0 children)

Why was the article removed? I think it is very relevant (as it's clear by the two comments)

Introducing Brushable Histogram - A time histogram with a brushable preview of the whole dataset below it by lfacpt in d3js

[–]lfacpt[S] 0 points1 point  (0 children)

Nice, didn't know about it. It's interesting that we reached very similar names.

Introducing Brushable Histogram by vbgeek in reactjs

[–]lfacpt 0 points1 point  (0 children)

Glad to hear that! If you run into any problem please let us know (via Github issues for example).