编译器发现了意外的字符
我正在研究React项目。 我要将一个组件导入到主组件中。
它具有传统的从“ react”;
行导入。 但是突然,编译器显示了有关SyntaxError的消息。它说它发现了“意外的角色:'?'。
它发现这个角色在第1行中的地方: '?''?'import React from 'react';
Fortunately, I solved it but restarting compiler. 但是我想知道为什么会发生这种情况?是否有任何解决方案可以防止将来发生此类错误?
I am working on React project.
There is a component that I'm importing to the main component.
It has traditional import React from 'react';
line.
But suddenly compiler display a message about SyntaxError. It said that it found 'Unexpected character: '?'.
And a place that it found this character is in line 1:'?''?'import React from 'react';
Fortunately, I solved it but restarting compiler.
But I want to know why did this happened? Is there any solutions that will prevent such errors in the future?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
由于它是在文件的开始,因此可能是字节订单标记;一些编辑器在编辑文件时会自动插入它。您使用什么编辑来进行更改?您最近是否使用其他任何东西打开它?
Since it's at the very beginning of the file, it might be the byte-order mark; some editors automatically insert it when you edit a file. What editor do you use to make changes? Did you recently open it using anything else?