I am very new to React, but was given a dump of code without much direction. I have an existing App.js
, with a number of hooks, and returns an HTML layout. How do I add a React component of react-countdown
to my existing code?
I need the countdown timer in a specific <div>
in my HTML, but can I just pass it in, like in the examples on this page?
import React from 'react';
import ReactDOM from 'react-dom';
import Countdown from 'react-countdown';
import App from './App';
ReactDOM.render(
<Countdown date={Date.now() 10000} />, //new code?
<App />,
document.getElementById('root')
);
CodePudding user response:
Simply, you can put the Countdown
component inside App like below
const App = () => {
return (
<>
<CountDown />
{OriginalCode here}
</>
)
}