Sign in
Log inSign up

TIL props in React.js

Divyesh Parmar's photo
Divyesh Parmar
·Jul 26, 2018

Since now there is also Jobs applying available here on our Lovely Hasnode I hope I land at some place soon, I have been giving interviews in India through AngelList with a backend profile as I can create web apps with Node.js and Express.js and was just rendering EJS templates on front-end part, before that I used to practice with Python Django as well. So yeah hopefully Hashnode also helps me achieve my first job as now I have also started diving into React.js ecosystem.

I have started learning React.js. I was mostly reading the articles on Medium from Kent C. Dodds and Tyler McGinnis, since they have the updated version of learning path available on the React.js in 2018

Also MarkErikson's repo for react-redux links is awesome and much more helpful while starting to learn.

Regarding the props and setState methods. I mostly learnt about the following keywords.

  • JSX - which lets us transpile HTML like syntax into simple Javascript

  • React - gives us excess to many major components to create and play around with it.

  • ReactDOM - it is a virtualDOM let's us modify it and later on simply checks it out with the actual real DOM, whether the nodes in real DOM changed or not
  • constructor - I come from Java background and I see constructor as the predefined function for that particular class regarding what kind of abstract methods and variables it will hold for us. also I have first time started using the extends and import . . . from . . . which is the new ES6 version of Javascript instead of using the normal require()
  • render() - it is an method which lets us render the component ( I still call it element unconsciously :D )

  • ReactDOM.render() - takes 2 arguments first is our created Component and other is the DOM-Node we want it to get attached to.

  • setState - which let me play around with the current state - this.state given by the constructor around

  • props - this is simply the data which is passed from parent node to child ( or should I say Elements? Oh no! they are called components damn it! )
  • propTypes - as the name suggests we can manipulate the type of prop that data being told to child element
  • defaultProps- nothing fancy but to just define how the component when it born.
  • ComponentLifeCycle - I haven't used this much on the 1st day itself. Need to learn more and Flux-Redux in upcoming days as fast as possible
  • Events - which were mostly, onSubmit, onChange. I'm sure there will be many

So this is all I learned and coded today to practice. I wish to learn as fast as I can and tomorrow I'm going to go on with Net Ninja's playlist though it is a bit old I love his style of teaching. I also have this YouTube playlist on my radar suggested by @Ryosuke, and it is pretty dope I'm mostly going to follow Stephen Grider's course on Udemy as well. Also I have given 46 interviews now here in India with Node.js/Express.js and Python Django on my resume with mostly backend developer thing, but it seems like no one wants to hire a fresher with these things or they pay as shitty low as possible, so I'm just putting my chin up and will keep on learning. One of the famous quote I heard from my favourite movie director

The world doesn't owe you anything, you owe it to yourself - Anurag Kashyap ( may be some famous writer I don't know I love Physics and Economics more then a novels though I like acting :p ) give your suggestion and must do things in my journey of learning React it will be really helpful.