score:1
sample demo.
send webpart context to component(in .ts file)
const element: react.reactelement<iofficeuifabricprops > = react.createelement(
officeuifabric,
{
description: this.properties.description,
context: this.context
}
)
update component(icomponent.ts file)
export interface iofficeuifabricprops {
description: string;
context:any;
}
in tsx file
private _getlistdata(clientcontext): promise<any> {
return clientcontext.sphttpclient.get(clientcontext.pagecontext.web.absoluteurl + `/_api/web/lists?$filter=hidden eq false`, sphttpclient.configurations.v1)
.then((response?: any) => {
return response.json();
});
}
render function
var testoptions=[];
this._getlistdata(this.props.context).then((data: any) => {
for (let i: number = 0; i < data.value.length; i++) {
//debugger;
testoptions.push({key:data.value[i].id,text:data.value[i].title,});
}
})
return (
<div >
<dropdown label="required dropdown example:"
options={testoptions}
/>
Source: stackoverflow.com
Related Query
- How to pass json into fabric ui dropdown component?
- How can I pass a jsx react component (with prop) into a Navbar component with a Dropdown properly?
- How to pass json values into React component
- How to pass in a react component into another react component to transclude the first component's content?
- How to pass values from a component into Formik multi-step form wizard?
- How to pass server data into React component
- How to pass graphQL query variable into a decorated react component
- How to pass return passed data back into a component to display in html
- How to pass a wrapped component into React Router without it constantly remounting
- How do I pass a value from an array defined in state into a component which beholds a component?
- How to pass route props into my functional component
- How to pass data from a component into getServerSideProps
- how to pass props into component from route array in react
- in react how to use reusable component as React Component to pass into react-router-dom Component prop?
- How to pass Grandchild data into GrandParent Component without passing data to intermediate components in Reactjs?
- How to pass Material-UI FlatButton CSS into other Button component
- How can I make useEffect not return the initial value? I keep getting empty array when I'm trying to pass an array of objects into a component
- How to pass a function into another component in react
- How to pass props into component from react-router Switch statement
- How to pass the dispatch into the component like prop?
- How can I pass a component as a prop into another component in React?
- How to pass down style into img tag from react semantic-ui Card component
- How do you pass a component into the attribute of a component in React?
- How to pass a React component (or raw html) into other React component and insert it?
- How to pass data of a component into another component?{ReactJS}
- How to pass params to Dropdown component from semantic ui react?
- How to pass json values between React component
- How can I filter json data from api call in react into different sections of the component
- How is it possible for me to pass margins into a component in React with typescript?
- searchkit - how to pass props into an itemComponent component
More Query from same tag
- Remapp object with arrays from api with new keys and structure
- How do I render a single Item fetched from the API ReactJS
- Do React or Next.js Internally Clean Class Properties?
- How to keep track of selected component?
- When looping through an array of objects I get a null value error
- UNSAFE_componentWillReceiveProps not called when using React 16.3.2
- Add image/button to React bootstrap table cell based on value of cell
- Cannot find module '../../images/Logo.png'.ts(2307) Red Error is Still showing
- Uncaught (in promise) DOMException: Document.querySelector with Google Fonts Link in NextJS
- Calling Set on a Firebase Database Reference Causes the Webpage to Hang
- Is using async componentDidMount() good?
- Simple Reactjs app without using npm and server?
- Solve pagination issues
- Animations with React JS
- How to access component form data in a Redux `matchDispatchToProps` function?
- Deploy Laravel and React spa
- Access to outer react component from referenced component
- How to make ajax call auto refresh in react js
- How can I filter through api data and print name to console?
- How to styling picture in div?
- How to add data attribute without value in react create element?
- How to separate all of socket.io to a different file
- Reusable child components with mobx store, should I reference the parent store to the child?
- Typechecking nested object properties with PropType
- Reactjs how to import constant array from another JavaScript file
- Why's my code firing inconsistently using onDoubleClick to send the server data?
- usestate not working for afterwards components
- Getting duplicate elements in react component after fetchMore
- handling error response from express to react
- Accessing props in .then (React/redux)