React Hands on & Tips

100DaysOfCode

React

100DaysOfCode – Days 8 to 12 – React

 I’ve spent the last few days learning more React, I needed to get to a point where I could solve simple tasks without copying the answer from other fellow, so I came back to freeCodeCamp and continue with the Front End Libraries Certification, just where I abandoned it because it was not getting the React concepts. Now after a week having my hands on in some code and easy problems, it has been quite a smooth path to follow and founding some interesting knowledge to keep in mind about React.

Here my list of things to have into account for my future React proyects:

  • The best practice with React is to place API calls or any calls to your server in the lifecycle method componentDidMount(). This method is called after a component is mounted to the DOM.
  •  The first is unidirectional data flow. State flows in one direction down the tree of your application’s components, from the stateful parent component to child components. The child components only receive the state data they need.
  • complex stateful apps can be broken down into just a few, or maybe a single, stateful component. The rest of your components simply receive state from the parent as props, and render a UI from that state. 
  • state updates may be asynchronous – this means React may batch multiple setState() calls into a single update. This means you can’t rely on the previous value of this.state or this.props.
  • Using a function with setState guarantees you are working with the most current values of state and props.
this.setState((state, props) => ({
  counter: state.counter + props.increment
}));
  • One common way is to explicitly bind this in the constructor so this becomes bound to the class methods when the component is initialized.
  • stateless functional component is any function you write which accepts props and returns JSX.
  • stateless component, on the other hand, is a class that extends React.Component, but does not use internal state (covered in the next challenge).
  • stateful component is a class component that does maintain its own internal state. You may see stateful components referred to simply as components or React components.
  • The componentDidMount() method is also the best place to attach any event listeners you need to add for specific functionality. 
  • React provides a synthetic event system which wraps the native event system present in browsers. This means that the synthetic event system behaves exactly the same regardless of the user’s browser – even if the native events may behave differently between different browsers. (Cool!!!!)
  •  FYI: As a rule, any hyphenated style properties are written using camel case in JSX.
  • Since React is a JavaScript view library and you can run JavaScript on the server with Node, this is possible. In fact, React provides a renderToString() method you can use for this purpose.

React Fresh start

100DaysOfCode

React

Hi there!

Today it’s my first day in the #100DaysOfCode, and I will start getting deeper with React. I already took some steps but I wanted for long to get a step forward, so here we go.

#100DaysOfCode – Day 1 : React

By now, I think we all know what React is and how well it’s rated right now, so I’m not going to waste your time, or mine, repeating what thousands of other sites can tell you. Without further ado, let’s get started!

How to get started with React – I found this “gem” in my “usual suspect” place to get all the good and free stuff about learning anything to do with coding, freecodecamp. It also includes a free guide to get React Ready with your JavaScript, is it not cool? I think it’s a great idea to know where you are and what you need to have to learn something. Well done, Chris!

Today, I read the JavaScript guide which I found clear and easy, I had a clear idea that I had all the knowledge needed and I continued with creating my new React app.

I had all the needed “weapons” to start the fight (Node.js, VSCode, etc) so I just had to type:

npx create-react-app my-app

And the magic started! I had a look in the contents and I will continue tomorrow with more React coding.

It was nice at least to get this stone rolling.

My Portfolio: All Done!

Thank you, Kevin Powell!

My Portfolio:

I cannot be happier!!! Today I finally had my portfolio done and published!

I’ve finally finished creating my portfolio. I can’t believe it. In the end it was quite painless and quite faster than I thought. Thanks to the help of Kevin Powell and FreeCodeCamp.
I didn’t want anything else, something simple, clean and fair about me, whoever wants to know more should ask.
Besides, while I was doing it, I learned a lot of CSS tricks. It was the cherry on top of the cake.

I didn’t have used before the Custom properties (Variables), and I just had a fair idea about transforms and transitions, quite powerful I have to say.
I started on Thursday and today Monday, last picture, last contents and last touches. Now I’m waiting for critics and opinions, but I’m much more relaxed after taking this weight off my shoulders.

Electronjs Seriously!

It's fast.

Electronjs

I finished the Desktop application that I was developing for ACM. Yes, I know, took one week or little more to do it with Electronjs, just to say that I didn’t have a clue one week ago what Electronjs was (shame on me), so not previous knowledge needed.

It is a small application that puts a “nice face” to an unfriendly sh file, which has to create an structure of files and folders, sometimes running some tests or just validating configurations.

I started my approach, creating a web application with raw HTML, JavaScript and JQuery, but it was limited and frustrating , and at the end it just fulfilled half of the requirements.

A colleague pointed out that it would be a good idea to have a Desktop Application for these requirements, above all for the limitation from JavaScript to “inter-actuate” with System files and folders. He was also the person who pointed out to Electronjs.

On the spot I started to read, to check the possibilities, what was this Electron about, and I liked it, even more when I created my first app from this video ( https://www.youtube.com/watch?v=kN1Czs0m1SU , Thank you Traversy Media), it was everything falling in place, HTML, CSS and Creating/ Accessing system files. Just perfect!

Maybe you are not into videos so, here a list of resources that I found useful when struggling with some points.

I’m looking forward to create another application with Electron, just to face new challenges and learn more about it. What about this EasyFinance app that I started in PHP and is dying of boredom? Let’s see, let’s see.