ReactJS is actually kind of fun

So, my latest experiment has been working with React. And like anything, there is a bit of a learning curve. React reminds me on many fronts of Knockout. It is a little "murkier" in its implementation. But, that isn't necessarily a bad thing.

React is very good, at least from what I've seen so far, at one thing; making modules.

It is quite easy to break things out into smaller, and theoretically more reusable pieces. And this is part of the reason I can not only tolerate, but also kind of appreciate the approach which mixes HTML like syntax in with JS in their JSX files.

My journey started with the default template generated by the .Net Core CLI. From there, I add my own controller, and patched their "FetchData" to load data from my controller.

Getting something even somewhat functional resulted in a file altogether too big for what came out the other end. If I'm going to have a file more than 100 or so lines I want to all be code, or all UI. Otherwise you need to start being judicious with yourself about how things are organized. And I can never settle on a standard.

But, a lot of what I did, I knew could, and should be stripped into other classes. And, so I went about figuring out how that works. And it was all rather painless. In some cases it actually simplified things compared to the original implementation.

There is still more that I can do on this front. But, I'm already getting my original page down to that 100 lines of code. In fact, if you take out white space, and comments and imports, I'm probably there.

I still have a lot to learn about React. And there are still certainly challenges and improvements I don't know how to make or if they are even possible. But, thus far, React is fun.

Comments

Popular Posts