I have developed an component which displays the table of data and an button which should leads to the another component to create an new item in the list.
I tried different approaches to get this component redirection on button click but not able to achieve this kind of redirection on button click event. With Router the thing is navigation always stays on the page.
Is this possible to achieve this task in spfx webpart with reactjs? please suggest.
Hi, You can navigate to different components in the same web part like navigating to a page based on the state variable. You can display or hide the component that you need to display based on the state variable. Once the button is clicked, hide the list component and then show the new item component. Please refer the below link to a simple poll, where questions and answers as one component and the chart results as another component, upon voting (click of a vote button) the answers were submitted and then showed the chart component. You can use the same logic in your solution too. https://github.com/SharePoint/sp-dev-fx-webparts/tree/master/samples/react-quick-poll
Hope it helps, please like it or mark it as a solution if it resolves ur clarification or issue -Sudharsan K...