Skip to content

How to add a block after the sixth element? #127

Discussion options

You must be logged in to vote

Unfortunately, your question doesn't provide sufficient details to paint the full picture, so I'll be making some assumptions.

You can use the following approach to add additional content after the last element in masonry layout:

<PhotoAlbum
    columns={3}
    layout="masonry"
    photos={photos}
    renderPhoto={({ layout, renderDefaultPhoto }) => (
        <>
            {renderDefaultPhoto()}
            {layout.index === photos.length - 1 && <div>Additional content</div>}
        </>
    )}
/>

Does this answer your question?

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@GreenEyeInvestor
Comment options

Answer selected by GreenEyeInvestor
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants