-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
✨ place the number of animations on first page
- Loading branch information
1 parent
8f8f1a1
commit 84cfcc8
Showing
2 changed files
with
35 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import React, { useEffect, useState } from "react"; | ||
|
||
const TotalComponents: React.FC = () => { | ||
const [total, setTotal] = useState<number>(0); | ||
|
||
useEffect(() => { | ||
const importAll = (r: __WebpackModuleApi.RequireContext) => { | ||
return r.keys().map(r); | ||
}; | ||
|
||
const jsonFiles = importAll( | ||
require.context("../../data", false, /\.json$/) | ||
); | ||
|
||
const totalComponents = jsonFiles.reduce( | ||
(acc, file) => acc + file.length, | ||
0 | ||
); | ||
setTotal(totalComponents); | ||
}, []); | ||
|
||
return ( | ||
<div> | ||
<p> | ||
We currently have <strong>{total}</strong> awesome UI components created | ||
by the React Native community! | ||
</p> | ||
</div> | ||
); | ||
}; | ||
|
||
export default TotalComponents; |
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