Random Quote Machine built by using a frontend frameworks React:
pavoninushka / random-quotes Goto Github PK
View Code? Open in Web Editor NEWFreeCodeCamp Project - Random-Quotes React
FreeCodeCamp Project - Random-Quotes React
Random Quote Machine built by using a frontend frameworks React:
Modern React relies on hooks, let's rewrite the project using them. See the relevant docs here https://reactjs.org/docs/hooks-intro.html
At the moment jQuery Ajax is used in App.js
to grab the file with quotes
componentDidMount() {
$.ajax({
headers: {
Accept: "application/json"
},
url:
"https://gist.githubusercontent.com/camperbot/5a022b72e96c4c9585c32bf6a75f62d9/raw/e3c6895ce42069f0ee7e991229064f167fe8ccdc/quotes.json",
success: (jsonQuotes) => {
let quotes = JSON.parse(jsonQuotes).quotes;
this.props.saveQuotes(quotes);
}
});
}
This can be rewritten using Fetch API.
Before the default case is used in the reducer as an initial state which could be not very tight approach.
It might be better to pass initial state to reducer as default parameter value and return the current state in the default case.
While running the app with npm start
, several warnings appears in terminal :
Line 91:19: Using target="_blank" without rel="noreferrer" is a security risk: see https://html.spec.whatwg.org/multipage/links.html#link-type-noopener react/jsx-no-target-blank
Line 120:3: Useless constructor no-useless-constructor
At the moment README.md
is filled with the default text left from create-react-app
. Would be great to replace it with the current project description.
As the repository name was changed to lowercase one needs to update a link in README.md and package.json as well.
After package.json
update one also needs to rebuild and redeploy the application.
It is tedious to run build
and deploy
manually each time. Let's write automation to run these commands for us. GitHub actions can be used for that.
E.g. an existing action https://github.com/JamesIves/github-pages-deploy-action or a custom one.
More about GitHub actions: https://docs.github.com/en/actions
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.