CharlesStover / reactn

React, but with built-in global state management.
https://www.npmjs.com/package/reactn
MIT License
1.89k stars 85 forks source link

Updated addCallback documentation, plus minor formatting enhancements. #181

Closed monteiz closed 3 years ago

monteiz commented 3 years ago

As discussed in #179, here is a pull request updating the addCallback documentation.

I took the chance to convert single quotes to double quotes and other minor formatting enhancements.

quisido commented 3 years ago

The single quotes are a deliberate choice, though I don't mind the parenthesis around parameters (better matching TypeScript). :)

I don't think I'd want the quotes changed, since it is a different code style than all my other projects.

monteiz commented 3 years ago

So, I was somehow waiting for that, because it makes sense.

But I want to give you an input: since you use single quotes, I guess you do not use prettier. It comes as a plugin for the most popular IDE, and it does an amazing job. I use it with vscode, configured for automatically formatting the code on file save, so I am saving hundreds or even thousands CMD+F each day.

By default prettier formats with double quotes. I think we should move to double quotes, since it is the standard for JSON, and JavaScript has template literals. This makes single quotes somehow obsolete in my view.

Prettier has formatted automatically also the md file, putting parenthesis around parameters. Cool, isn't it?

So, to me is very easy to change double quotes to single quotes, no problem (writing this comment took more time). But think about it one or two days, and let me know if you change your mind ;)

monteiz commented 3 years ago

Updated using with single quotes ;)

quisido commented 3 years ago

I do use Prettier, and my newer projects have a Prettier config to enforce single quotes. Great tool. ReactN is such an old project, it was simply before I ever discovered Prettier. Any 3.x release of this project will have a prettier config as well as the other project configs found here.

At one point in time, single quotes had better performance than double; but I'm sure that has long-since been optimized out of existence by the engine. Today, I prefer single quotes, because it is less visual noise. Things like linters and Prettier for sure should be used to enforce these things, and the lack of it here is just evidence of the project's age. 😅

Thank you for the contribution. :)

monteiz commented 3 years ago

Any 3.x release of this project will have a prettier config as well as the other project configs found here.

Great choice!

evidence of the project's age

This project is an evergreen, because it is still the best option out there for the global state management of a React application ;)

If needed, I will be happy to contribute further to documentation.