简体   繁体   English

如何使用 js 使用 Replit JSX react

[英]How to use js using Replit JSX react

Hi so I am a high school student and for my project for cs class we are supposed to make a website about something we are passionate about.嗨,我是一名高中生,对于我的 cs 课程项目,我们应该制作一个关于我们热衷的事物的网站。 We are using replit.com.我们正在使用replit.com。 it is a online ide.这是一个在线ide。 I don't really know much about it but when I go to create a react project it goes to make a jsx file.我对它了解不多,但是当我创建一个 React 项目时,它会创建一个 jsx 文件。 How do I covert this to normal js?我如何将其转换为普通 js?

Replit uses Vite for its React projects (Vite is a JavaScript build tool that makes developement faster- checkout Replit's official blog post here ). Replit 将 Vite 用于其 React 项目(Vite 是一种 JavaScript 构建工具,可以加快开发速度 - 请在此处查看Replit 的官方博客文章)。 Vite requires .jsx files to process JSX. Vite 需要 .jsx 文件来处理 JSX。 If you had created a react application using create-react-app you could've renamed the files to .js and it'd still work.如果您使用create-react-app创建了一个 React 应用程序,您可以将文件重命名为 .js 并且它仍然可以工作。 You'll have to work with .jsx files if you are using Replit.如果您使用 Replit,则必须使用 .jsx 文件。

Refer this tweet for explanation by Evan You 请参阅此推文以获取 Evan You 的解释

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM