Core Concept of React

Mohammad Osman Goni
2 min readMay 7, 2021

What is React?

React is a Javascript library that use for building User Interface. It is not framework .

What is DOM?

DOM is Document Object Model . it is a platform that allows programs and scripts to dynamically access and update the content style of a document.he DOM represents a document with a logical tree

Virtual DOM

It’s a programming concept where an ideal or a User Interface(UI) is kept in memory and synced with the “real” DOM by a “Library” such as ReactDOM.

How to React to Application Start?

npx create-react-app app-name

Component

React components is similar in look different in data.A React component takes an optional input and returns a React element which is rendered on the screen

JSX

JSX does the Create Element.using JSX you can write concise HTML/XML.React.createElement(component, props, …children) This is the main syntax in JSX.

States

State is very important topic in react. We change the state by calling setState or using useState. These changes cause parts of the component to re-render, and possibly to its children.

How to write React useState?

const [ value, setValue ] = useState(null);

How to write Conditional Rendering?

{ture ? “This is Ture” : “This is False”}

Context API

this method to pass data from components. It returns a consumer and a provider. provider is a component that as it’s names suggests provides the state to its children.Consumer as it so happens is a component that consumes and uses the state.

Default Props

Default Props mean default props… I mean you see my Examples:

componentName.defaultProps = { color: black}

This color is the default props color.

--

--