Skip to content

Instantly share code, notes, and snippets.

View E-fais's full-sized avatar

Fais Edathil E-fais

View GitHub Profile
import React, { useState } from 'react';
function CreateTeams({ players }) {
// Calculate the ideal size for each team
const teamSize = Math.ceil(players.length / 2);
// Filter players into different skill categories
let goodPlayers = players.filter(player => player.skill === "good");
let averagePlayers = players.filter(player => player.skill === "average");
let bestPlayers = players.filter(player => player.skill === "best");
create a new project in firebse website
set firestore
set authentication
create a collection in firestore
firestore rules change read and write permission
------------------------------------------------
go to react application
npm install firebase
//example without pagnation:-
const [myState,setMystate]=useState([])
//set some values for the state
myState.map(item=>{
<h1>{item.title}</h1>
})
//example for mui pagination:-
const [myState,setMystate]=useState([])
//set some values for the state
When we use react-browser-router and useContext in a project, there is a chance for getting error.So we need to add a Fragment tag as follows.
app.js
************
function app =()=>{
return(
<GlobalContext.Provider>
<Fragment>
<Routes>
<Route path='/' element={<home.js/>}/>