Archives : March-2021

If my url path starts with a /-IDNUMBER, I want the react-router to render the Home Component. For example if the URL is: /-MX9EnU6aOtENtdQxLvF or /-MX9F3z22XrMjlgEAHUI it should render the Home Component. I assume the best way to do this is to use Regex (let me know if there is a better way). Here is ..

Read more

I’m trying to build a dynamic router with React. The idea is that the Routes are created from the data (object) received from the backend: Menu Object: items: [ { name: "dashboard", icon: "dashboard", placeholder: "Dashboard", path: "/", page: "Dashboard", exact: true, }, { name: "suppliers", icon: "suppliers", placeholder: "Suppliers", path: "/suppliers", page: "Suppliers", exact: ..

Read more

I have a ReactNative app that simply uses a webview to display our react website. Our site allows users to view emails, and in order to properly render these email messages we use an iframe. So our iframe looks like this: <iframe className={’email-view-body-iframe’} srcDoc={pViewMessage.body}/> Where srcDoc is the body of the message that is to ..

Read more

Background I have an chart which displays static data just fine. Using this template https://github.com/creativetimofficial/black-dashboard-react/blob/master/src/variables/charts.js On my main page [dash.js] I have an API call, (which I tested presents the data I expect by using console.log(). I will be looking to have this data working dynamically so I have created it using useEffect and useState. ..

Read more

I am currently developing in a react project and I want to show the current page title in my header. To currently do this, I am using the props.location.pathname and a switch-case to get the desired output. This looks something like below. var currentPathname = this.props.location.pathname; switch (currentPathname) { case ‘/’: return ‘Home’; } The ..

Read more