maintext/ react

4)  react

React makes it painless to create interactive UIs. Design simple views for each state in your application, and React will efficiently update and render just the right components when your data changes.

4.1)

Component-Based

Build encapsulated components that manage their own state, then compose them to make complex UIs.

Since component logic is written in JavaScript instead of templates, you can easily pass rich data through your app and keep state out of the DOM.

4.2)

Learn Once, Write Anywhere

We don’t make assumptions about the rest of your technology stack, so you can develop new features in React without rewriting existing code.

React can also render on the server using Node and power mobile apps using React Native.

4.3)

A Simple Component

React components implement a render() method that takes input data and returns what to display. This example uses an XML-like syntax called JSX. Input data that is passed into the component can be accessed by render() via this.props.

JSX is optional and not required to use React. Try the Babel REPL to see the raw JavaScript code produced by the JSX compilation step.

4.4)

A Stateful Component

In addition to taking input data (accessed via this.props), a component can maintain internal state data (accessed via this.state). When a component’s state data changes, the rendered markup will be updated by re-invoking render().


4.5)How to apply:

import React, {Component} from 'react';// we have to import react "Component" from react to add the Component property in'App
class App extends Component {//extends component
render(){
return(
<>
<h1>This is the heading of this project</h1>                     <h3>This is the body of this project</h3>                     <p>Footer</p>
</>
);
}
}
export default App;//export 'App' class to index.js and in you index.js
import React from "react";
import ReactDOM from "react-dom";
import App from "./App";
ReactDOM.render(<App />, document.getElementById("root")); this will render the content of app.js in index.js which is going to be rendered by index.html



Comments

Popular posts from this blog

Generative AI Model for text summarization

Resume description for AI/ ML Developer