New answers tagged

0

Well, the best option that I can think of now is to use react-router's history.listen(location => () => locationChangeHandler(location)), works perfectly in React app, although haven't tried with SPFx yet


0

I would try something like: In myWebpart constructor: localStorage.getItem('location') === window.location.href ? "do nothing" : "aha, navigation occurred !" save window.location.href in localStorage as 'location' // every time


0

An empty list means no colors in state, am I right? So just a small insert in your render method should work I guess: public render(): React.ReactElement<IReactWebPartDemoProps> { return ( <div className={ styles.reactWebPartDemo }> <div className={ styles.container }> <div className={ styles....


0

When using the SharePoint Framework to build react-based solutions, you must use the exact react version that ships with the version of SPFx you are using. The main reason being that SharePoint and SPFx do many optimizations and want to avoid version conflicts on the page. It also helps them provide support. SPFx version 1.8.2 ships with react 16.7.0 and ...


0

Sample demo: public render(): void { document.body.insertAdjacentHTML('beforeend', `<a style="position:absolute;top: 150px;left:120px;height: 50px;" target="_blank" href="https://www.google.com/">Google</a>`); }


1

Gaelle, React takes a bit of getting used to when you get started. One of the things that can make it difficult to learn React is that some of the samples out there can be quite old. For example, findDOMNode is considered deprecated; instead, you should create refs for the elements you want to query/manipulate. Typically, you'll want to create a private ...


0

@Sebastian, If you want the feedback to appear outside of a web part (and, I assume, on every page?), you should look at creating a SharePoint Framework Extension instead. See https://docs.microsoft.com/en-us/sharepoint/dev/spfx/extensions/get-started/build-a-hello-world-extension The good news is that you should be able to re-use most of your existing ...


Top 50 recent answers are included