尝试导入错误:“ showErrorMessage”未从“ ../helpers/alerts”导出

时间:2020-07-02 19:28:24

标签: javascript next.js

我在文件夹../ helpers / alerts

中有一个名为Alerts.js的文件。
all_boards = client.list_boards()
last_board = all_boards[-1]
print(last_board.name)
board = client.list_boards()[0]

board.list_lists()


all_boards = client.list_boards()
last_board = all_boards[-1]
last_board.list_lists()
list 
my_list = last_board.list_lists()[number]

print(my_list.list_cards())

我尝试将这两个函数导入另一个文件中

const showSuccessMessage = (success) => {
    <div className="alert alert-success">{success}</div>
}
const showErrorMessage = (error) => {
    <div className="alert alert-success">{error}</div>
}

module.exports ={
    showErrorMessage, showSuccessMessage
}

但是我一直收到

尝试导入错误:“ showErrorMessage”未从中导出 '../ helpers / alerts'。

1 个答案:

答案 0 :(得分:1)

您可以尝试以下代码吗?

export const showSuccessMessage = (success) => {
    <div className="alert alert-success">{success}</div>
}
export const showErrorMessage = (error) => {
    <div className="alert alert-success">{error}</div>
}
import {showSuccessMessage, showErrorMessage} from '../helpers/alerts'