frankcollins3 / fill_container

codecamp team project updated with new icon screen menu + puppeteer icon search, GraphQL, redux, relational psql !mongo, and accuweatherAPI
1 stars 0 forks source link

infinite loop through render [1:17am] #236

Closed frankcollins3 closed 1 year ago

frankcollins3 commented 1 year ago

attempting to do:


Show that the water drops illustrate a streak of perfect water cycling Screen Shot 2023-06-20 at 1 19 59 AM

Screen Shot 2023-06-20 at 1 20 41 AM

localContHover === false ?

:


error returned: Screen Shot 2023-06-20 at 1 14 25 AM

Screen Shot 2023-06-20 at 1 14 11 AM

👍 onMouseEnter={setLocalContHover(true)} // the first UI allows for the toggling to show the second container 👎 onMouseLeave={setLocalContHover(false)} // i don't understand why this doesn't work.

because when you enter, the container toggles to render {renderStreakExplain()} as far as I see in the logic, there wouldn't be an infinite render because it would toggle back to original cont upon mouseLeave

meaning that the cursor would no longer be on the container, leaving cont ready to be {mouseEntered()} again.

infinite render?

proposed approach: hover onto the () () water droplet container:

frankcollins3 commented 1 year ago

that function is better off as the mouseLeave

[1:31am]

frankcollins3 commented 1 year ago

this works:

  const contHoverFunc = () => {
      setTimeout( () => setLocalContHover(true), 1000)
      setTimeout( () => setLocalContHover(false), 3000)
  }

  return (
    <div className="streak-container">
        {
    localContHover === false ? <ul onMouseLeave={contHoverFunc}>{streakData.length > 0 && <>{renderStreak()}</>} </ul> : <ul>{streakData.length > 0 && <>{renderStreakExplain()}</>} </ul> 
        }          
    </div>
  );

[1:36am]