assignment5 Blogpost code review #1
Loading…
Reference in a new issue
No description provided.
Delete branch "dev"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@ -0,0 +1 @@
remove file
@ -0,0 +28,4 @@
return (
<div className="App">
<ul>
run prettier on whole code
@ -0,0 +1 @@
export const api_url = "https://jsonplaceholder.typicode.com/posts";
do not push env file
@ -0,0 +2,4 @@
import Body from "./Body";
import SearchBar from "./SearchBar";
import "../styleing/layout.css";
import { api_url } from "../env";
wrong way of importing env fix this
@ -0,0 +9,4 @@
const [filteredData, setFilteredData] = useState([]);
const [currentPage, setCurrentPage] = useState(1);
const fetchData = async () => {
refactor code and make reusable function /hook
@ -0,0 +25,4 @@
if (!searchTerm) {
setFilteredData(data);
} else {
const filtered = data.filter(
add opting chaining
@ -0,0 +27,4 @@
} else {
const filtered = data.filter(
(post) =>
post?.title.toLowerCase().includes(searchTerm?.toLowerCase()) ||
add optional chaining .
@ -0,0 +31,4 @@
post?.body.toLowerCase().includes(searchTerm?.toLowerCase())
);
if(filtered.length>0){
setFilteredData([filtered[0]]);
fix this
@ -0,0 +12,4 @@
width: 300px;
border: 1px solid #ccc;
border-radius: 4px;
background-color: #f9f9f9;
user css variables
@ -0,0 +30,4 @@
<ul>
{filteredData.length > 0 ? (
currentPosts.map((post) => (
optional chaning
devto assignment5 Blogpost code review