Skip to content
Advertisement

Tag: reactjs

How to get pathname in the layout file in gatsby

I am working with gasby and here the main file is always layout.js which is the parent of them all. Since it is a parent file then how can I get a location props this.props.location.pathname inside it? Here is my layout component Answer As stated in the Gatsby docs: In v1, the layout component had access to history, location, and

Setting custom directory for server files for Next.js

Rather than in the root directory, I want to keep all my backend related files inside a folder named ‘server’. The problem is now the frontend won’t load properly as it can’t find the ‘pages’ directory. I remember there was a way to set the directory somehow when initializing the app but I don’t remember the specifics. Can someone please

Center component inside the material-ui grid

I want to use same cards and make them center aligned, I searched and tried some solutions but all of them align only the component grid, and not the component content itself (I need them to be equally distant form the borders and from themselves). I’m using this code (https://codesandbox.io/embed/32o8j4wy2q): The card code is irrelevant but I just copied the

Advertisement