📜  物化反应 - Javascript代码示例

📅  最后修改于: 2022-03-11 15:01:56.180000             🧑  作者: Mango

代码示例2
import React from 'react';
import M from 'materialize-css';
....
// ref can only be used on class components
class SomeComponent extends Component {
  // get a reference to the element after the component has mounted
  componentDidMount(){
    M.Sidenav.init(this.sidenav);
  }

  render(){
    return (
      
    {this.sidenav = sidenav} } id={this.props.id}> // menuItems
) } }