JSFiddle - React, Tailwind, and code Playground

HTML

<?php
	function get_comments($file_id) {
		include 'database.php';

		$result = mysqli_query($connect, "SELECT * FROM `comments` WHERE `file_id`='$file_id' AND `is_child`=FALSE ORDER BY `date` DESC");
		$row_cnt = mysqli_num_rows($result);

		echo '<h1>Comments ('.$row_cnt.')</h1>';
		echo '<div class="comment">';
			new_comment();
		echo '</div>';

		foreach($result as $item) {
			$date = new dateTime($item['date']);
			$date = date_format($date, 'M j, Y | H:i:s');
			$auth = $item['author'];
			$par_code = $item['com_code'];
// WHERE `par_code`='$par_code' AND `is_child`=TRUE    add_comment($item['author'], $item['com_code']);
			$chi_result = mysqli_query($connect, "SELECT * FROM `comments` WHERE `par_code`='$par_code' AND `is_child`=TRUE");
			$chi_cnt = mysqli_num_rows($chi_result);

			echo '<div class="comment" name="'.$item['com_code'].'">'
					.'<span class="author">'.$auth.'</span><br />'
					.$item['comment'].'<br />'
					.'<span class="date">Posted: '.$date.'</span><br />';

					if($chi_cnt == 0) {
						echo '<span class="replies">No replies</span>'
							.'<span class="replies">&emsp;Reply</span>'
							.add_comment($item['author'], $item['com_code']);;
					} else {
						echo '<span class="replies">[+] '.$chi_cnt.' replies</span>'
							.'<span class="replies"&emsp;Reply</span>';
							delete_comment()
							.add_comment($item['author'], $item['com_code']);
						echo '<div name="children" id="children">';
						foreach($chi_result as $com) {
							$chi_date = new dateTime($com['date']);
							$chi_date = date_format($chi_date, 'M j, Y | H:i:s');

							echo '<div class="child" name="'.$com['com_code'].'">'
									.'<span class="author">'.$com['author'].'</span><br />'
									.$com['comment'].'<br />'
									.'<span class="date">Posted: '.$chi_date.'</span><br />'
								.'</div>'
								.edit_comment();
						}
						echo '</div>';
					}
				echo '</div>';
		}
		mysqli_close($connect);
	}

	function add_comment($reply, $code)...