无法在Node中的类中定义常量? [英] Const can not be defined in class in Node?

查看:69
本文介绍了无法在Node中的类中定义常量?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我应该在哪里放置以下行以准备好组件?

Where should I put following line to get my component ready?

const classes = useStyles();

尝试使用Material-UI MenuList组件,但需要在我现有的MainPage代码中使用,与Material-UI代码示例稍有不同.

Try to use Material-UI MenuList component, but need to use in my existing MainPage code, what is slightly different from Material-UI code example.

推荐答案

常量.

您有两个选择.

  1. 将常量移出类,然后引用.
  2. 使用静态属性

此线程有更多信息. 是在ES6类中声明静态常量吗?

This thread has some more information. Declaring static constants in ES6 classes?

这篇关于无法在Node中的类中定义常量?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆