In the below code, you can see how to return HTML output to the front end.
import React, { Component } from "react"; import "./App.css"; class App extends Component { render() { return React.createElement( 'div', { className: 'App' }, React.createElement('h1', null, 'Hello from React') ); } } export default App;
Instead of sending the direct HTML text using createElement method of React, we can use the jsx syntax.
It is same as HTML code but with minor changes and placeholders to the React code inside it.
The default sample project contains JSX only in the return part.
No comments:
Post a Comment