ReactJS — What are props?

Daniel Bergmann
2 min readNov 25, 2020

--

ReactJS is a front end javascript library that organizes code by placing them in separate components. They allow you to split the UI into independent and reusable pieces. They are then put together so so developers can easily change elements without needing to repeat themselves.

This is a very useful and powerful way to organize code to make it more sustainable and easier to work with.

One element of ReactJS that confuses a lot of people is the idea surrounding ‘props’.

‘Props’ stands for Properties

A React component containing a prop

The Order component above contains a function with the prop as an argument. We initialize it by having props as a parameter and then we would surround it inside the JSX code. Like so:

{props.foodName}

But wait… What the hell is foodName?

That's simply the name of our variable that helps us finish defining our function.

So when all is said and done it would end up like this.

A react component and a variable containing a prop

--

--

Daniel Bergmann
Daniel Bergmann

Written by Daniel Bergmann

0 Followers

Daniel Bergmann is a developer located in Reykjavik, Iceland.

No responses yet