0.1.0 • Published 5 years ago
cra-template-contexts-firebase v0.1.0
Starterkit for a REACT project :rocket:
Features:
- Context API
- Firebase configuration
- Material UI
Created from react 16.13.1 (08/2020)
Usage
to start dev mode use npm start
Context API
- copy
src/scripts/contexts/userContext.jsand paste it in the same folder with a new name (eg. cartContext) - modify cartContext
initialStateandreducer - import cartContext in
src/scripts/contexts/index.js - set the provider using
withContext( App )(usually in src/index.js)
when you want to use the context
import contexts from "..../scripts/contexts";- use the hook:
const [cart, dispatcher] = contexts.cart.useContext();(cart contains the value of the context; dispatcher starts events that trigger the reducer function, which updates the context)
Firebase configuration
- userContext was configured to detect changes in the user's auth
src/scripts/firebase.jsdeclares which services are needed by the app (auth, firestore, storage, ...)- modify
.envto set your firebase API key
Material UI
- modify
src/scripts/material/theme.jsto set your preferences in the theme (colors, responsiveness, global styles, typo, ...)
0.1.0
5 years ago