Skip to content

when component update code blocked not update the data #27

@adventuretocode

Description

@adventuretocode

Hi i am facing the issue.

Package version i am using "react-copy-code": "^2.1.2",
how to use the componentDidUpdate with codeBlock
Code example
let dynamic_str = "this is dynamic code ".${val1} string to more like ${val2} `
return (
{/* this html tag render the correct dynamic string */}

 ${dyanamic_str} 

{/* this CodeBlock tag render the Incorrect dynamic string when component update dynamic string not updating */}
<CodeBlock
className="App"
componentDidUpdate
text
highlight
onCopy ={() => alert("Code copied ")}
>


{" "}

{`

            dataLayer.push({ ecommerce: null });
            dataLayer.push({
              ${dynamic_str}
              });
           
            </script>`}
        </code>
      </pre>
    </CodeBlock>
    
     );

};

    `

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