Skip to content

Instantly share code, notes, and snippets.

Avatar
:shipit:
something need to do

louis.luo wildfrontend

:shipit:
something need to do
View GitHub Profile
@wildfrontend
wildfrontend / bulma-react-router.md
Last active Sep 30, 2020
How to use bulma tabs active class name on the parent element with React router
View bulma-react-router.md
@wildfrontend
wildfrontend / why we dont need to use --save-dev.md
Last active Sep 11, 2020
why we dont need to use `npm install --save-dev`
View why we dont need to use --save-dev.md

As of NPM 5, saving is done by default

--save-dev is only needed if we’re building a node app;

since we output minified JS for production via npm run build, everything is a dev dependency,

so it doesn’t actually matter in practice whether modules are added to dependencies or devDependencies in package.json.

View Why closing a page does not unmount the component.md
View fetch-try-catch-pattern.md

prepare

  • rewrite fetch to catch httpcode
const httpCodeFetch = async ({ url, config = initialConfig }) => {
    const res = await fetch(url, config)
    if (res.status === 204) return {}
    if (res.ok) {
        return res.json()
View React-Router-Nest-NotFound.md

https://github.com/ReactTraining/react-router/issues/4685

  1. add in
  2. add Global 404
Hey guys, so today I've came across this exact same issue and I was able to get something working to render a "global not found" component, while keeping the benefits of sharing some UI within a "parent" route. I wanted to share this with you, in case you find this useful for your case :)

Consider the routes I need to support:
@wildfrontend
wildfrontend / AppendComponent.js
Created Jul 16, 2020
create dymanic component
View AppendComponent.js
const App = () =>{
const [conunt,setConunt] = useState(1)
return (
<div>
{Array(conunt).fill(<RepeatCompnent/>)}
</div>
)
}
View blobToDataURI.js
function blobToDataURI(blob, callback) {
const reader = new FileReader()
reader.readAsDataURL(blob)
reader.onload = function (e) {
callback(e.target.result)
}
}
@wildfrontend
wildfrontend / README.md
Created Jun 5, 2020
tailwind.css with css-in-jss , react setup
View README.md