Jarvis1010 / react-copy-code

A React component to add copy to clipboard funcitonality to 'pre code' blocks
MIT License
9 stars 4 forks source link

when component update code blocked not update the data #27

Open adventuretocode opened 1 year ago

adventuretocode commented 1 year ago

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>

     );

};

    `
travis-waith-mair commented 5 months ago

I'm sorry I am just seeing this. This repo really should be message that It is no longer being maintained.