Skip to content

holder.js does not work when the page renders twice in React #225

Closed
@jguo1002

Description

@jguo1002

I am using holder.js in React with react-bootstrap. In index.html I added in <header>:
<script src="holder.js"></script>

In the component ProjectCard I wrote:
<Card.Img className="proj-card-img" variant="top" data-src="holder.js/100px180" />

This component is rendered using map() function

{Object.keys(this.state.projects).map(key=>
     <ProjectCard key={key} index={key} details={this.state.projects[key]}/>)}

It works nicely if I set state in ComponentWillMount(). However, if I update the state and the page renders twice (e.g. use firebase to syncState), holder.js will not work.

I have tried

<script>
    Holder.run({
        images:"MyClassName"
    })
</script>

but it didn't work either.

Did I write anything wrong? Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions