This file contains hidden or 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
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/>}/> |
This file contains hidden or 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
//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 |
This file contains hidden or 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
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 |
This file contains hidden or 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
<section class="my-foto-gallery"> | |
<div class="foto-gallery-container"> | |
<div class="foto-gallery-item"> | |
<img class="foto-gallery-image" src="./Assets/images/sample.jpg"> | |
</div> | |
<div class="foto-gallery-item"> | |
<img class="foto-gallery-image" src="./Assets/images/sample.jpg"> | |
</div> | |
<div class="foto-gallery-item"> | |
<img class="foto-gallery-image" src="./Assets/images/sample.jpg"> |
This file contains hidden or 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
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"); |