diff --git a/snippets/Tabs.md b/snippets/Tabs.md new file mode 100644 index 000000000..8582e9974 --- /dev/null +++ b/snippets/Tabs.md @@ -0,0 +1,99 @@ +### Tab +Renders a tabbed menu and view component. + +Define `TabItem` as a middleware, pass it to the `Tab` and remove unnecessary nodes expect for `TabItem` by identifying the function's name in `props.children`. +Use `Array.prototype.map` on the collected nodes to render the `tab-menu` and `tab-view`. +Define `changeTab`, which will be executed when clicking a ` + ))} + +
+ {items.map(({ props }) => ( +
+ ))} +
+
+ ); + } +} +function TabItem(props) { + return
; +} +``` +```jsx +ReactDOM.render( + + + Lorem ipsum + + + Dolor sit amet + + , + document.getElementById("root") +); + +``` + + + +