function in react
function Welcome(props) {
return <h1>Hello, {props.name}</h1>;
}
function App() {
return (
<div>
<Welcome name="Sara" /> <Welcome name="Cahal" /> <Welcome name="Edite" /> </div>
);
}
ReactDOM.render(
<App />,
document.getElementById('root')
);class App extends Component {
constructor() {
super()
this.state = {
name: "Sally",
age: 13
}
}
render() {
return (
<div>
<h1>{this.state.name}</h1>
<h3>{this.state.age} years old</h3>
</div>
)
}
}function MyApp() {
return (
<div>
<ul>
<li>Name </li>
<li>Place </li>
<li>Animal </li>
</ul>
</div>
)
}
ReactDOM.render(
<MyApp />,
document.getElementById('root')
);class MyComponent extends React.Component{
constructor(props){
super(props);
};
render(){
return(
<div>
<h1>
My First React Component!
</h1>
</div>
);
}
};
Also in JavaScript:
- jQuery exclude exteranl link for images
- synchronous vs asynchronous functions javascript
- how to use fetch() to fetch an image from database in js
- trigger button click jquery
- JsonConvert.DeserializeObject convert into dynamic datatable
- invoking jquery validator
- facebook integration in node.js
- react native text-input-mask this.props.refInput
- prepend option on 2nd index jquery
- jquery add div element
- react prevstate
- launch.json vscode electron
- how to pass a value to a react funtion without immediately firing it
- check if js object is empty
- js open link onmouseup
- express js continous GET /json/version
- not equal to sign in js
- vue js on checkbox show div
- angular flex layout
- jsx babel webpack
- npm create react app
- how to get value of button that click on it jquery
- new Map() collection in react state
- downgrade angular version in project