0

I have to maintain an old project, and when I look into the code, it shocks me.

(function($, React, ReactDOM){
...............
 ReactDOM.render(<App/>, $("#root")[0]);
})(
jQuery, React, ReactDOM)

The backend language is C#. I didn't know backend so it's hard for me to figure out how this project works.

  1. it put all components in one file(one file one page), the code is really long. It didn't use any import and export syntax. Now I need to add new page, I want to use many files and use import to put it together. Is this possible?
  2. I didn't find where it import react, maybe the cshtml file in the Views folder I guess. I want to use a new version of React with my new page, is this possible?

1 Answer 1

1

The question is pretty vague as it stands, but I don't see how it could be improved in its current state.

Depending on the lifetime, future ownership, and current use of the project you're maintaining, it may make sense to refactor it as you describe in [1] and update to the React version you want to use. Yes, it is of course possible, but it is work.

As for [2], I don't know either way if it is possible to use different versions of React to render different parts of the project. That would certainly be interesting to see. I would recommend trying to stick to one version across the application -- otherwise the next poor soul who needs to update this project will have the same reaction you've had.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.