Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

206
Views
How to move a DOM element into a separate component in React?

I am trying to move a DOM element in one component into a separate component. Basically, the div needs to move up two parent levels.

Current placement of the DOM element

Goal placement of the DOM element

I have two components at play:

  1. AuthFlow.js
  2. SignUp.js
//AuthFlow.js
{renderForm()}
      {formType === 'signUp' && (
        // This div needs to move up 
        <div className="mt-6">
          <p className="font-body text-white">
            Already have an account?{' '}
            <span
              className="text-quad cursor-pointer"
              onClick={() => updateFormType('signIn')}
            >
              Sign In
            </span>
          </p>
        </div>
      )}
// SignUp.js
... 
</div>
        <button
          className="transition-all transform hover:translate-y-1 rounded-md bg-tertiary py-3 mt-6 cursor-pointer border-2 border-transparent focus:outline-none focus:ring-2 focus:ring-tertiary focus:border-transparent"
          onClick={signIn}
          title="Sign In"
        >
          Sign in
        </button>
        // Eventual placement of the Div I want to move
      </form>

I've looked into React portals, but I am not sure if that is the way to go.

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!