This React Star Wars blog was designed to make us practice everything we had learned so far in the frontend part of the course: Javascript and code that follows programmatic logic, React (combining components, using hooks, using flux in order to have global state and actions), interacting and calling upon APIs for our website's data, and CSS in order to make the blog page look good.
The project can be seen below or at the live version here
This boilerplate comes with a centralized general Context API. The file ./src/js/store/flux.js
has a base structure for the store, we encourage you to change it and adapt it to your needs.
React Context docs BreathCode Lesson view
The Provider
is already set. You can consume from any component using the useContext hook to get the store
and actions
from the Context. Check /views/demo.js
to see a demo.
import { Context } from "../store/appContext";
const MyComponentSuper = () => {
//here you use useContext to get store and actions
const { store, actions } = useContext(Context);
return <div>{/* you can use your actions or store inside the html */}</div>
}