react-insta-stories icon indicating copy to clipboard operation
react-insta-stories copied to clipboard

Redirection on See more

Open saurabhsinha1991 opened this issue 5 years ago • 3 comments

Currently, seeMore can load a new component. Is there a way to redirect to a new url on click of seemore?

saurabhsinha1991 avatar Jan 20 '20 19:01 saurabhsinha1991

Currently, seeMore can load a new component. Is there a way to redirect to a new url on click of seemore?

I am also facing similar issue while redirection. @mohitk05 can you please help us with it? Thanks in advance. :)

swayam2k15 avatar Jan 21 '20 04:01 swayam2k15

One way to solve it using a thunk:

const seeMoreFactory = (url) => {
  return ({close}) => {
    close()
    window.open(url, '_blank')
    return null
  }
}

const stories = data.map(story => ({
  url: story.image,
  type: 'image',
  seeMore: seeMoreFactory(story.link)
}))

const App = () => (
  <Stories
    stories={stories}
  />
)

iMerica avatar Mar 06 '20 08:03 iMerica

AWESOME Imerica

vasc1 avatar Jul 22 '20 09:07 vasc1