This project is a clone of LeetCode built using React. It allows users to solve coding problems and test their solutions against provided test cases.
The Context API is used for managing authentication state across components. AuthProvider
wraps the entire application to provide authentication context.
// AuthProvider.js
import { createContext, useContext } from "react";
const AuthContext = createContext();
export const useAuth = () => useContext(AuthContext);
const AuthProvider = ({ children }) => {
// Authentication state management logic
};
export default AuthProvider;
Firebase Authentication is used for user authentication. useAuthState hook is used to track authentication state.
// CodeEditor.js
import { useAuthState } from "react-firebase-hooks/auth";
import { auth } from "../../../firebase";
const [user] = useAuthState(auth);
React Router DOM is used for routing within the application. Different routes are defined using Routes and Route components.
/// App.js
import { BrowserRouter as Router, Routes, Route } from "react-router-dom";
function App() {
return (
<Router>
<Routes>
<Route path="/" element={<Hero />} />
{/* Other routes */}
</Routes>
</Router>
);
}
Destructuring is used extensively to extract values from objects and arrays.
// CodeEditor.js
const { examples, id, starterCode, handlerFunction } = Problem;
Dark and Light mode functionality is implemented using Daisy UI components and CSS classes toggling.
// ThemeToggle.js
import { useColorMode } from "daisyui";
const ThemeToggle = () => {
const { colorMode, toggleColorMode } = useColorMode();
return (
<button onClick={toggleColorMode}>
{colorMode === "dark" ? "Light Mode" : "Dark Mode"}
</button>
);
};
- Clone the repository.
- Install dependencies:
npm install
. - Start the development server:
npm start
. - Access the application in your browser at Vatsa-LeetClone.
This project was built by D S Srivatsa, and Susheel K as part of Geekster's React Module Project.
Our front end React project was made using Project resources and referance taken from the fullstack nextjs proj :-
FCC Build and deploy Leetcode clone using Next.js
This project is licensed under the MIT License - see the LICENSE file for details.