I am creating a community in the financial Services cloud where I have used a standard component(tab) and inside the tab I am placing my custom component that I have created. The name that I have given to the tab is Business Acocunt. Is it possible to access the tab name inside my custom component to use it and display data accordingly?
No, your component doesn't have access to attributes of the component(s) which contain it. Your component would need to expose its own attribute where you could set the desired value in Lightning App Builder or the Community builder.
Related
I have a problem with accessing the React Context object in my Custom Document page (Next.js).
Since I am working on a cookie banner for GDPR purpose, I want to use the React Context state in order to prevent the analytic scripts to be fired in the Custom Document page, if the GDPR is not accepted by the user.
However, I cannot figure out how to access the React Context state within my custom _document.js page.
Is that possible at all?
Or is there another good way in next.js how I can implement the GDPR Cookie Banner?
Many thanks in advance!
JP
I'm a bit new to React.
My company is starting to build a product than needs to be customized by any client.
Is it possible to create a component (let's call it plugin) and deploy it into a folder in a production environment and that component being rendered without recompiling the entire app?
e.g.: I have a form and i need another form calling a client's API that renders some info and then pass that info to the main app form. That 2nd form should be this kind of plugin, due to the fact that it depends on the clients' APIs for the component to render a table, a chart, or whatever the component itself renders.
I've been googling and i haven't found a solution yet.
Thank you all :D
So i have a search field sitting in my header class and i want to pass the search value to the content which is sitting in another class so can anyone tell how to do that?
This is the purpose of redux and having a global state. You can check out a starter react redux project I built for more details. But basically you will need to dispatch actions which will update the global state from one class and then is accessible by all other components in your app.
https://github.com/iqbal125/modern-react-app-sample
I developed a React component representing a window that allows the user to interact with a chatbot. This window opens when the user clicks a button. Now, I want to make this button available in any site or application of my choice. The first idea that came to mind is to associate a URL to this button so I can call it in our site or application by simply creating a link like:
Chat with the robot .
I find the idea functional but I do not know how to associate a URL to a component in React. I looked at the React-Router side of what I understood it just allows to create the navigation between component of the same application but I do not know if its URL can be accessible outside the application where they are created.
Do you know any tips for solving such problems?
And if you have ideas other than linking the URL to the component, I'm interested.
Thank you in advance !!!
You cannot use a react component by pulling it in as external code. react-router works by wrapping you application. Any component you want to use has to be part of the actual codebase.
Being new to ReactJS, I wanted help with the global variable declaration and usage. The scenario is that I have different modules and I want to access a variable which is available in all the modules, irrespective of their relations. To be precise, I have an admin panel and a user dashboard which have no common parent. But, I wish to set a value of a variable in admin panel and use that value in user dashboard and other modules. I tried looking out for solutions but couldn't get a feasible solution. It would be a great help if the solution is explained using an example.
Not sure about your exact use-case and what is most suitable for you, but there are several patterns more suitable to concepts of react, that provide an ability to use shared variable in different components:
Declare a variable in the top-level container-component and pass it down through props to desired children.
Use state managers (Redux, Mobx etc.) and access state (any kind of data) from any component.
Context API
Making a parent for both the components and passing states between them solved my problem. For my use case, I defined the Admin Home Page Component (where the state was set) and User Login Component (where I had to access the state) into a common Parent Component and defined this Parent Component into App (where all the other components were defined). This solved my issue of accessing the state of the component and providing it to another component which had no common relationship.