Gathering detailed insights and metrics for react-demos
Gathering detailed insights and metrics for react-demos
Gathering detailed insights and metrics for react-demos
Gathering detailed insights and metrics for react-demos
npm install react-demos
Typescript
Module System
Min. Node Version
Node Version
NPM Version
70.9
Supply Chain
98.6
Quality
75.8
Maintenance
100
Vulnerability
100
License
TypeScript (68.87%)
CSS (29.14%)
HTML (1.31%)
JavaScript (0.68%)
Total Downloads
2,437
Last Day
3
Last Week
4
Last Month
26
Last Year
252
9 Stars
33 Commits
3 Watching
1 Branches
1 Contributors
Latest Version
0.0.13
Package Id
react-demos@0.0.13
Unpacked Size
208.86 kB
Size
47.86 kB
File Count
32
NPM Version
6.14.7
Node Version
12.18.0
Cumulative downloads
Total Downloads
Last day
0%
3
Compared to previous day
Last week
-69.2%
4
Compared to previous week
Last month
271.4%
26
Compared to previous month
Last year
-30.8%
252
Compared to previous year
1
1
plug and play React components to show off your backend tech by implementing a small set of methods! Done in TypeScript because I like React + TypeScript. Use this as an easy demo to show off your backend integrations. (e.g. React + Firebase, React + AWS Amplify, React + Node/Express/Mongo, etc.)
goes without saying - none of these are meant for production!
1npm i react-demos
1import * as React from 'react' 2import * as ReactDOM from 'react-dom' 3import { Chat, useChatLocalState } from 'react-demos' 4 5const App = () => { 6 const { 7 currentUser, 8 sendMessage, 9 loginUser, 10 logoutUser, 11 messages, 12 usersOnline, 13 } = useChatLocalState() 14 // // To implement: 15 // currentUser: User | null; 16 // usersOnline: User[]; 17 // messages: Message[]; 18 // /** set currentUser and add them to usersOnline */ 19 // async function loginUser(name: string) {} 20 // /** add to messages by also adding the currentUser */ 21 // async function sendMessage(text: string) {} 22 // /** (optional) unset currentUser and remove from usersOnline */ 23 // async function logOutUser(id: string) {} 24 return ( 25 <div> 26 <Chat 27 {...{ 28 currentUser, 29 sendMessage, 30 loginUser, 31 logoutUser, 32 messages, 33 usersOnline, 34 }} 35 /> 36 </div> 37 ) 38}
Here are the schemas of the 2 models used:
1export type User = { 2 id: string 3 name: string 4 isOnline: boolean 5} 6export type Message = { user: string; text: string }
1type User @model { 2 id: ID! 3 name: String 4 isOnline: Boolean 5} 6 7type Message @model { 8 id: ID! 9 user: String 10 text: String 11}
TodoMVC with a clean React implementation (no Redux).
Live Demo: react-todomvc.netlify.app
The core of this package is a <Todos>
component that takes 5 props:
todos: TodoType[]
: an array of TodoType
objectsaddNewTodo: (value: string) => Promise<void>
: callback for adding a new todoupdateTodo: (modifiedTodo: PartialTodoType) => Promise<void>
: update the value or completion state of a Todo by its id
deleteTodo?: (id: string) => Promise<void>
: optional callback for deleting a todo by IDclearCompletedTodos?: () => void
: optional callback for clearing completed todos (if omitted, the corresponding button won't show)todosTitle?: string
: optional string - to customize the title shown. defaults to "React-TodoMVC"
.For demo purposes, a sample implementation is provided from useTodosLocalState
. The intent is that you will swap out these functions for your own as you implement your backend.
1import { Todos, useTodosLocalState } from 'react-demos' 2import 'react-todomvc/dist/todomvc.css' // for styling 3 4const App = () => { 5 // FOR DEMO CREATOR: replace this with your impl! 6 const props = useTodosLocalState() 7 // // must implement 8 // todos: TodoType[] 9 // function addNewTodo(value: string): Promise<void>` 10 // function updateTodo(modifiedTodo: PartialTodoType): Promise<void>` 11 // // optional 12 // function deleteTodo(id: string): Promise<void> 13 // function clearCompletedTodos(): void 14 // todosTitle?: string 15 return ( 16 <div> 17 <Todos {...props} /> 18 </div> 19 ) 20} 21 22ReactDOM.render(<App />, document.getElementById('root'))
If you want something that persists in localstorage, you can use useTodosLocalStorageState
instead. It has the same API as useTodosLocalState
.
The http://todomvc.com/ project
the todomvc.css
was combined from todomvc-app-css
and todomvc-common
.
No vulnerabilities found.
Reason
no dangerous workflow patterns detected
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
Found 0/30 approved changesets -- score normalized to 0
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
no SAST tool detected
Details
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
67 existing vulnerabilities detected
Details
Score
Last Scanned on 2024-12-16
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More