-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
create custom MAP compoenent, env setup, and performance drawback str…
…ick setup
- Loading branch information
yagnik-finestar
committed
Apr 27, 2023
1 parent
696ebb6
commit 65dd7bf
Showing
12 changed files
with
85 additions
and
106 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
declare namespace NodeJS { | ||
interface ProcessEnv { | ||
REACT_APP_API_KEY: string; | ||
REACT_APP_API_URL: string; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,2 @@ | ||
import axios, { AxiosInstance } from 'axios'; | ||
|
||
/* | ||
* Create a new instance of Axios | ||
* | ||
* If you are using different URLs, consider removing this line and adding a baseURL in the Axios Config parameter. | ||
*/ | ||
export const api: AxiosInstance = axios.create({ | ||
baseURL: 'https://api.github.com', | ||
headers: { | ||
"Content-type": "application/json" | ||
} | ||
}); | ||
// Get your API key from the environment variables. | ||
export const API_URL = process.env.REACT_APP_API_URL?.trim() || ''; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { MapProps } from "../../@types/Type"; | ||
|
||
// Define the component as a function that takes the props as an argument | ||
function Map<T>({ data, renderItem }: MapProps<T>): JSX.Element { | ||
/* | ||
* • Use the `map` method to iterate over the `data` array and render | ||
* the items using the `renderItem` function | ||
*/ | ||
return <>{data.map((element, index) => renderItem(element, index))}</>; | ||
} | ||
|
||
/* | ||
* • Export the component and its props interface for use in other parts | ||
* of the application | ||
*/ | ||
export default Map; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters