• Что бы вступить в ряды "Принятый кодер" Вам нужно:
    Написать 10 полезных сообщений или тем и Получить 10 симпатий.
    Для того кто не хочет терять время,может пожертвовать средства для поддержки сервеса, и вступить в ряды VIP на месяц, дополнительная информация в лс.

  • Пользаватели которые будут спамить, уходят в бан без предупреждения. Спам сообщения определяется администрацией и модератором.

  • Гость, Что бы Вы хотели увидеть на нашем Форуме? Изложить свои идеи и пожелания по улучшению форума Вы можете поделиться с нами здесь. ----> Перейдите сюда
  • Все пользователи не прошедшие проверку электронной почты будут заблокированы. Все вопросы с разблокировкой обращайтесь по адресу электронной почте : info@guardianelinks.com . Не пришло сообщение о проверке или о сбросе также сообщите нам.

React to Vue Conversion with Claude, Gemini, and ChatGPT

Lomanu4 Оффлайн

Lomanu4

Команда форума
Администратор
Регистрация
1 Мар 2015
Сообщения
1,481
Баллы
155
This post covers converting my

Пожалуйста Авторизируйтесь или Зарегистрируйтесь для просмотра скрытого текста.

from React to Vue using GitHub Copilot Pro in VSCode.

Project size:

  • 8 JSX components
  • 8 asset files (TailwindCSS, images)
  • 4 WASM files
  • index.js

The app has only 3 screens, so it is quite an uncomplicated project.


Пожалуйста Авторизируйтесь или Зарегистрируйтесь для просмотра скрытого текста.



Online React to Vue Converters


All online tools offering React to Vue conversion that came up on page one in Google produced unusable garbage.
It was not good enough even for a boilerplate.

I DO NOT recommend any of these tools:

GitHub Copilot


GitHub Copilot is the default AI Chat choice for VSCode.
You may also consider using

Пожалуйста Авторизируйтесь или Зарегистрируйтесь для просмотра скрытого текста.

or

Пожалуйста Авторизируйтесь или Зарегистрируйтесь для просмотра скрытого текста.

.

If you are new to using

Пожалуйста Авторизируйтесь или Зарегистрируйтесь для просмотра скрытого текста.

, there is one customization I highly recommend - disable Send on Enter setting to enter multiline prompts.

  • Open Keyboard Shortcuts (Ctrl-K + Ctrl-S)
  • Search for workbench.action.chat.submit
  • Change from Enter to Shift+Enter or any other key combination you like


Пожалуйста Авторизируйтесь или Зарегистрируйтесь для просмотра скрытого текста.



More info:

Converting the Entire Project ?


Attempts to convert the entire project in one go failed.
All the models clearly prefer the user to break it down into smaller steps, e.g. create scaffolding, improve it, add linters, NPM packages and then convert the components one by one.

I could have asked the LLM for the action plan, correct it and then ask to execute.
Doing the conversion in small steps seemed like a better approach.

Converting a Single React Component ?


My NavBar component had only 71 lines of code and used a single dependency, useAuth0 from @auth0/auth0-react for authentication.

Full file:

Пожалуйста Авторизируйтесь или Зарегистрируйтесь для просмотра скрытого текста.



Prompt


It took me a few attempts to come up with a prompt that produced a meaningful conversion with navbar.js as the context:


Convert the current react component into a VueJS component to go into an existing app structure.
Assume that any functions, objects or APIs called from the component exist somewhere.
Copy comments as-is.
Use TypeScript, VueJS composition API.

I asked ChatGPT to improve it. The new prompt was more readable, but made no difference to the end result - all models produced the same output for both.


Convert the provided React component into a Vue 3 Single File Component that fits into an existing Vue application structure.

Use TypeScript and the VueJS Composition API.
Preserve all comments exactly as they appear in the original code.
Assume that any external functions, objects, or APIs referenced in the component are available elsewhere in the project.
Ensure the resulting Vue component is idiomatic and ready for integration into a typical Vue app.
Claude 3.7 Sonnet


The worst result of them all:

  • didn't follow the composition API structure
  • left placeholders
  • unusual formatting

Vue file:

Пожалуйста Авторизируйтесь или Зарегистрируйтесь для просмотра скрытого текста.



Claude 3.5 Sonnet


A much better result with a few minor issues:

  • window.location.port == 80 should be "80" in TypeScript
  • process.env.VUE_APP_BUILD_TS should be import.meta.env.VITE_APP_BUILD_TS
  • inconsistent use of '' and ""

Vue file:

Пожалуйста Авторизируйтесь или Зарегистрируйтесь для просмотра скрытого текста.



Gemini 2.5 Pro


A very similar result to Claude 3.5 Sonnet.

The <template> part was nearly identical with only syntactical and formatting differences for the rest of the code.


Пожалуйста Авторизируйтесь или Зарегистрируйтесь для просмотра скрытого текста.



Vue file:

Пожалуйста Авторизируйтесь или Зарегистрируйтесь для просмотра скрытого текста.



ChatGPT-4.1


A nearly identical result to Claude 3.5 Sonnet and Gemini 2.5 Pro.

Vue file:

Пожалуйста Авторизируйтесь или Зарегистрируйтесь для просмотра скрытого текста.



Conclusion


No clear winner - I used Claude, Gemini, and ChatGPT interchangeably.

The LLMs did about 80% of the work.
The converted code was mostly correct, but not production-ready.

The full conversion took me 2 days including unrelated bug fixes.

From this React:

Пожалуйста Авторизируйтесь или Зарегистрируйтесь для просмотра скрытого текста.



To this Vue:

Пожалуйста Авторизируйтесь или Зарегистрируйтесь для просмотра скрытого текста.



Question


Could one of these brilliant golden retrievers on acid completely replace me for this task?

Not yet.


Пожалуйста Авторизируйтесь или Зарегистрируйтесь для просмотра скрытого текста.

 
Вверх Снизу