using dot notation in jsx
//Let's implement <Menu> <Menu.Item>Wow, anubra266</Menu.Item></Menu>
// menu.js
import React, { Component } from 'react';
export default const MenuItem = ({ children }) => <li>{children}</li>;
export default class Menu extends Component {
static Item = MenuItem;
render() {
return (
<ul>{this.props.children}</ul>
);
}
}
//----------------------------------------------------------------
//App.js
import React from 'react';
import { render } from 'react-dom';
import Menu from './menu';
const App = () => (
<Menu>
<Menu.Item>Home</Menu.Item>
<Menu.Item>Blog</Menu.Item>
<Menu.Item>About</Menu.Item>
</Menu>
);
render(<App />, document.getElementById('root'));
Also in JavaScript:
- computed property name javascript
- how to get file extension in javascript last index
- ladder physics javascript
- jquery on modal show
- for of mdn
- js remove from array by value
- javascript run something after x seconds
- javascript add div before element
- how to get all elements with same class in javascript
- Embed Example Discord.js
- javascript file preview
- javascript linting
- log javascript
- behaviorsubject in angular 10
- set multiple attributes javascript
- change background colour jquery
- react merge two objects
- convert hashmap into json
- babylon js camera position
- javascript create object empty
- timeout httppost angular
- 404 page setup in angular routing
- how to send data using ajax in php
- vue js error mixed spaces and tabs no-mixed-spaces-and-tabs