I am working on a tasklist page. The main page has a form in which the user would add the task and click on the add task button and the corresponding task would be appended to the "todo-task" div. I am using my own created react element (Do laundry is just for example) which returns a checkbox followed by the text passed as prop. In the following code I am trying to append at the end of our todo-task div but it is showing me some error. Is my approach right? If not what approach should I take?
import React,{useState} from 'react'
import './Tasklist.css'
import Button from 'react-bootstrap/Button';
import AddBoxIcon from '@material-ui/icons/AddBox';
import Checkbox from '@material-ui/core/Checkbox';
import Task from './Task.js';
function Tasklist() {
const [task, settask] = useState("")
let pendingTask = document.getElementById('pending-task')
let doneTask = document.getElementById('done-task')
const addTask = (event)=>{
    event.preventDefault()
    let tmp_text=task.trim()
    if(tmp_text==="")return
    let task_tmp = document.createElement(<Task text={tmp_text} />);
    pendingTask.appendChild(task_tmp);
    settask("");
}
const keyDownEvent=(e)=>{
    let key=e.key
    if(key==='Enter' && !e.shiftKey)addTask(e);
}
return (
    <>
        <div className="add-task">
            <form >
                <textarea 
                    type="text" 
                    value={task}
                    rows={1}
                    placeholder="Add Task" 
                    onChange={(e)=>settask(e.target.value)}
                    onKeyDown={keyDownEvent}
                    />
                <Button variant="outline-primary" onClick={addTask}>
                    <AddBoxIcon /> Add Task
                </Button>
            </form>
        </div>
        <div className="todo-task" id="pending-task">
        </div>
        
        <Task text="Enjjoyyyy!!!" />
        <hr />
        <div className="done-task" id = "done-task">
            <ul id="done-task-list">
            </ul>
        </div> 
    </>
)
}
export default Tasklist