Skip to content

Conversation

@shekharkhedekar
Copy link

Adds the following props for increased customization:

  • idleTimeout Allows users to customize the delay timeout for window.requestIdleCallback
  • placeholder Allows users to pass a JSX element as the placeholder for increased flexibility over placeholderElement/placeholderClass

@shekharkhedekar
Copy link
Author

@GusRuss89 @daleperforce this has been useful in our project - we ended up using a quicker timeout (200) and a react component as the placeholder. LMK if this is something you'd be open to.

@daleperforce
Copy link
Contributor

@shekharkhedekar Please explain why you need a new placeholder instead of using the placeholderElement?

The timeout as a configurable seem ok to me.

@shekharkhedekar
Copy link
Author

shekharkhedekar commented Mar 27, 2024

@shekharkhedekar Please explain why you need a new placeholder instead of using the placeholderElement?

The timeout as a configurable seem ok to me.

@daleperforce Good question!

We have a loading skeleton react component that we would like to put in, so our usage ends up looking like this:

<RenderIfVisible
    visibleOffset={2000}
    idleTimeout={200}
    stayRendered
    placeholder={
        <div className="container">
            <LoadingSkeleton />
        </div>
    }
>
    <MyRepeatingElement />
</RenderIfVisible>;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants