July 31, 2025

Automating Flow Duplication in Power Automate for New SharePoint Site Creations

Introduction:

Setting up workflows in Power Automate can take a lot of time, especially when the same workflows need to be recreated every time a new SharePoint site is created. 

Instead of manually creating the same workflows repeatedly, you can automate the process. This means that whenever a new SharePoint site is created, the necessary workflows are automatically duplicated and configured without any manual intervention. 

In this blog, we will walk through the steps to automatically duplicate Power Automate flows whenever a new SharePoint site is created.

Use case:

One of our clients required that a specific Power Automate flow be automatically replicated whenever a new SharePoint site was created. Manually duplicating the flow each time wasn’t scalable, so we implemented an automated solution. 

Architecture Overview:

Here's a high-level overview of the automation process: 

  • Trigger: A new SharePoint site is created. 

  • Retrieve: The definition of the existing (source) flow is fetched. 

  • Update: The flow definition is modified to align with the new site’s parameters. 

  • Recreate: A new flow is created from the modified definition and assigned to the new site.


Step-by-Step Guide to Automating Workflow Duplication

Step 1: Detect New Site Creation

Add a trigger that detects when a new SharePoint site is created.

Step 2: Get the Source Flow(Template Flow)

Use the Power Automate Management connector. 

Add the action "Get Flow" to retrieve the definition of the existing (template) flow. 

This action returns a JSON object containing the flow’s full definition, including triggers, actions, and metadata. 




Step 3: Get Flow Definition and Modify Site-Specific Values

You will now modify the values in the flow definition to suit the new site. 

Update the flow definition retrieved from the "Get Flow" action by replacing the template’s Site URL and List Name or Library ID with the values from the newly created SharePoint site. 

In Power Automate, this is typically accessed using dynamic content like

string(body('Get_Flow')?['properties']['definition'])

 


Step 4: Get All Connection References

Use the "Select" action to format the connection references by mapping fields like connectionName, id, and source from the connectionReferences array, These will be used when creating the new flow.

 

 

Step 5: Create New Flow in Target Environment

Use the "Create Flow" action from the Power Automate Management connector to create the new flow using the modified definition and updated connection references.

Environment Name: Choose your environment

Flow Display Name: Provide a unique name

Flow Definition: Pass the modified JSON definition from Step 3

Flow State: Set this to control whether the flow is turned on/off after creation

connectionReferences: Pass the formatted connection references from Step 4



Conclusion:

This blog demonstrated how to automate the creation of workflows in Power Automate by duplicating an existing flow. By implementing this automation, you can eliminate repetitive manual setup each time a new SharePoint site is created. This approach not only saves time and reduces the chance of errors but also ensures consistency across all sites.


If you have any questions you can reach out our SharePoint Consulting team here.

React Context vs Redux vs Zustand: Making the Right Choice for Scalable Apps

Introduction

Managing state in a React application is one of the most important tasks for frontend developers. Whether you're working on a small project or a large enterprise application, choosing the right state management tool can affect your app’s performance and maintainability.

In this blog, we’ll explore the differences between React Context, Redux, and Zustand, and help you decide when to use each.


What is React Context?

React Context API is a feature built into React that allows you to share data across multiple components without passing it manually through props. It’s great for small-scale apps or static data like:

  • Light or dark theme 
  • Language settings 
  • User login status

But it’s not ideal when your app has lots of changing data or performance-sensitive features. 


What is Redux?

Redux is one of the most well-known state management libraries used in React. It uses a centralized store, with state updated through a strict pattern involving actions and reducers. Redux is a powerful tool for large applications with complex logic and shared data.

Benefits of Redux:

  • Centralized and predictable state
  • Powerful middleware support
  • Developer tools and time-travel debugging

Challenges: It can be complex to learn and introduces extra boilerplate code.


What is Zustand?

Zustand is a lightweight, modern alternative to Redux. It provides a minimal API and great performance with much less code. Zustand is ideal for small to medium applications and for developers who want something quick and clean to manage state.

Why choose Zustand?

  • Simple and minimal setup
  • High performance with fine-grained updates
  • Supports server-side rendering and middleware


 Comparison Table

Feature

React Context

Redux

Zustand

Built-in

Setup Complexity

Simple

Complex

Very Simple

Best For

Small Apps

Large-Scale Apps

Small to Medium Apps

Performance

⚠️ Not optimized

✅ Good

✅ Excellent

Boilerplate

Minimal

High

Minimal

DevTools


Conclusion

Choosing between React Context, Redux, and Zustand depends entirely on your project’s size, complexity, and how often your data changes. There is no “one best option” - just the right one for the right situation.

Start simple. Use React Context for basic needs, Zustand when you want performance with simplicity, and Redux when your app grows in size and requires structured, scalable state management.

July 24, 2025

Modern SharePoint - Creating Site Pages with Section Templates and Real-Time Previews

Introduction:

SharePoint has long been a cornerstone for businesses looking to manage content and collaborate effectively. With its user-friendly interface and out-of-the-box features, SharePoint enables users to create dynamic, engaging web pages with minimal technical knowledge. The Modern SharePoint experience has taken this a step further with new features like Section Templates, which allow you to create visually consistent pages without needing to start from scratch.

These templates not only save time but also ensure your pages are visually appealing, structured, and aligned with your brand's identity. SharePoint’s recent updates bring even more flexibility and real-time feedback to the content creation process, empowering users to build professional, polished pages.

In this blog, we’ll dive deep into how you can leverage Section Templates, customize section properties, and make the most of real-time previews to build dynamic pages that are ready for publication - without the need to save or publish.


Step-by-Step Guide to Using SharePoint Modern Page Templates and Section Templates:

1. Navigating to the Page Editor:

To get started, head to the Site Content section of your SharePoint site. From here:

  • Click on ‘New’ and select ‘Page’. This action will open the Page Editor. 


2. Accessing Section Templates:

  • Once you’re inside the page editor, on the right-side pane, you’ll find the ‘Section Templates’ option. Click on ‘See All Section Templates’ at the bottom to view a comprehensive list of pre-designed templates.
section templates 

  • These templates are organized based on the content type and layout, making it easy to choose one that fits your needs.

3. Selecting and Customizing Your Template:

SharePoint gives you the ability to browse and select from a wide variety of templates. Once you pick one that fits your page’s needs, you can start customizing it to fit your brand’s style. You can:

  • Modify text and images
  • Change the layout and section arrangement

This allows you to design pages without needing to start from scratch, which is especially useful for non-developers or anyone looking to save time.

4. Customizing Section Properties:

Once you’ve chosen your template, you can further customize individual sections to suit your specific needs. SharePoint allows you to modify several properties for each section, including:

  • Collapsible Sections: You can make sections collapsible to save space and control how much content is visible. This is especially useful for pages with a lot of information.
  • Heading Levels: Customize the heading structure for better hierarchy and readability.
  • Divider Lines: Use divider lines to create separation between sections for a cleaner, more organized look.
  • Alignment Options: Control the alignment of content within each section (e.g., left or right alignment for expand/collapse icons).
  • Mobile and Email Reflow: Adjust how content reflows on mobile devices or in email formats (top to bottom, left to right). This ensures a seamless experience across all devices.
section properties

By customizing these properties, you can fine-tune the page layout and user experience, all while maintaining flexibility for different content types.

5. Previewing the Changes:

One of the best features of SharePoint’s page editor is the Preview function. You can see how your page will look across devices (desktop, tablet, mobile) in real time. This means you can:

  • Make adjustments without having to publish the page first.
  • Fine-tune the layout to make sure it’s perfect across different screen sizes.
CMS

This feature eliminates the guesswork that typically comes with designing web pages, ensuring your page looks great before it’s live.

6. Saving and Publishing Your Page:

Once you’ve customized the template, previewed your changes, and are happy with the result, it’s time to save and publish your page. SharePoint makes this process as easy as clicking a button, allowing you to get your content online quickly.


Benefits of Using Modern Section Templates and Real-Time Previews in SharePoint:

1. Time Efficiency:

  • With pre-designed templates, the process of creating web pages becomes much faster. Instead of starting from scratch, you can simply select a template that fits your needs and modify it to suit your content.

2. Flexibility and Customization:

  • The ability to customize section properties—from text and images to layouts and headings—ensures that your page aligns with your organization’s branding while allowing for personal adjustments.

3. Real-Time Preview:

  • The Preview feature allows you to instantly see how your page will look across devices. This ensures that your page is mobile-responsive, aesthetically pleasing, and ready for prime-time publishing.

4. Empowering Non-Developers:

  • Thanks to SharePoint’s drag-and-drop interface, even users with little to no development experience can quickly create professional pages. The ease of use is one of the platform's strongest features, making it accessible for everyone in your organization to contribute to content creation.


Advantages of Section Templates:

  • Consistency: Ensures uniform layout structure within a single page for a professional look.
  • Time-saving: Pre-designed sections make it quick and easy to build structured content without starting from scratch.
  • Flexibility: Offers customization options for text, images, and content layout within the selected section.
  • Mobile Responsiveness: Automatically adjusts to provide an optimal viewing experience across devices. 
  • User-friendly: No coding required, making it easy for non-developers to create visually appealing pages. 


Disadvantages to Consider:

  • Limited Scope: Section templates apply only to a single page, with no cross-page functionality for consistency across multiple pages. 
  • Customization Constraints: While flexible, templates may not allow advanced customizations for complex page layouts.
  • Dependency on Pre-Designed Layouts: Overreliance on templates could lead to uniformity across pages, reducing uniqueness.
  • Performance Issues: Certain complex sections might introduce performance bottlenecks if not optimized properly.

 

Conclusion:

The introduction of Modern Section Templates in SharePoint has dramatically improved the content creation process. These tools allow users to quickly build professional, brand-consistent pages without needing advanced design skills or coding experience. Whether you’re updating a page with a new event, creating a team introduction, or posting an internal status update, these features make it easier than ever to create pages that look great and are optimized for mobile devices.

With real-time previews, customizable section properties, and a growing library of templates, SharePoint’s new features bring efficiency and flexibility to web content management. While there are limitations, such as limited customization options and potential for design uniformity, the benefits - time savings, ease of use, and consistency are undeniable. These tools are a game-changer for both developers and non-developers alike.

So, whether you’re building your first page or refining an existing one, SharePoint’s Section Templates are here to help you create stunning web pages that are ready to publish at the click of a button.


If you have any questions you can reach out our SharePoint Consulting team here.

React Best Practices: A Comprehensive Guide

In this guide, you'll learn the top React best practices that can help you create clean, scalable, and high-performing apps. Whether you're just getting started or looking to improve your skills, this comprehensive guide covers everything from component structure and state management to performance optimization and code organization.

Component Design and Architecture:

Keep Components Small and Focused
The Single Responsibility Principle applies strongly to React components. Each component should have one clear purpose and do it well. Large components become difficult to test, debug, and maintain.
// ❌ Bad: Large component doing too much
function UserDashboard({ userId }) {
  // 200+ lines of code handling user data, notifications, settings...
}

// ✅ Good: Focused components
function UserDashboard({ userId }) {
  return (
    <div>
      <UserProfile userId={userId} />
      <NotificationPanel userId={userId} />
      <UserSettings userId={userId} />
    </div>
  );
}
Use Composition Over Inheritance
React favors composition patterns. Instead of complex inheritance hierarchies, compose components together to build complex UIs.
// ✅ Good: Composition pattern
function Card({ children, title }) {
  return (
    <div className="card">
      <h2>{title}</h2>
      {children}
    </div>
  );
}

function UserCard({ user }) {
  return (
    <Card title="User Profile">
      <img src={user.avatar} alt={user.name} />
      <p>{user.bio}</p>
    </Card>
  );
}

State Management:

Use the Right Tool for State
Not all state needs to be in a global store. Choose the appropriate state management solution based on your needs:
  • Local state (useState): Component-specific data that doesn't need sharing
  • Lifted state: Shared between a few related components
  • Context: App-wide state like themes or user authentication
  • External libraries: Complex state logic (Redux, Zustand, MobX)
// ✅ Good: Local state for component-specific data
function SearchInput({ onSearch }) {
  const [query, setQuery] = useState('');

  const handleSubmit = (e) => {
    e.preventDefault();
    onSearch(query);
  };

  return (
    <form onSubmit={handleSubmit}>
      <input 
        value={query}
        onChange={(e) => setQuery(e.target.value)}
        placeholder="Search..."
      />
    </form>
  );
}
Minimize State Dependencies
Keep your state flat and avoid deeply nested objects. This makes updates easier and prevents unnecessary re-renders.
// ❌ Bad: Nested state
const [user, setUser] = useState({
  profile: {
    personal: {
      name: '',
      email: ''
    }
  }
});

// ✅ Good: Flat state
const [userName, setUserName] = useState('');
const [userEmail, setUserEmail] = useState('');

Performance Optimization:

Memoization Strategies
Use React's built-in memoization tools wisely, but don't overuse them. Premature optimization can make code harder to read without significant benefits.
// ✅ Good: Memoize expensive calculations
const ExpensiveComponent = memo(function ExpensiveComponent({ data }) {
  const processedData = useMemo(() => {
    return data.map(item => complexCalculation(item));
  }, [data]);

  return <div>{processedData.map(renderItem)}</div>;
});

// ✅ Good: Memoize callback functions passed to children
function ParentComponent({ items }) {
  const handleItemClick = useCallback((id) => {
    // Handle click logic
  }, []);

  return (
    <div>
      {items.map(item => 
        <ChildComponent 
          key={item.id} 
          item={item} 
          onClick={handleItemClick} 
        />
      )}
    </div>
  );
}
Avoid Inline Objects and Functions
Creating objects or functions inline in render methods causes unnecessary re-renders of child components.
// ❌ Bad: Inline objects cause re-renders
function MyComponent() {
  return <ChildComponent style={{ margin: 10 }} />;
}

// ✅ Good: Define objects outside render or use useMemo
const styles = { margin: 10 };

function MyComponent() {
  return <ChildComponent style={styles} />;
}

Custom Hooks:

Extract Reusable Logic
Custom hooks are perfect for sharing stateful logic between components. They keep your components clean and promote code reuse.
// ✅ Good: Custom hook for API calls
function useApi(url) {
  const [data, setData] = useState(null);
  const [loading, setLoading] = useState(true);
  const [error, setError] = useState(null);

  useEffect(() => {
    const fetchData = async () => {
      try {
        setLoading(true);
        const response = await fetch(url);
        const result = await response.json();
        setData(result);
      } catch (err) {
        setError(err);
      } finally {
        setLoading(false);
      }
    };

    fetchData();
  }, [url]);

  return { data, loading, error };
}

// Usage in component
function UserProfile({ userId }) {
  const { data: user, loading, error } = useApi(`/api/users/${userId}`);

  if (loading) return <Spinner />;
  if (error) return <ErrorMessage error={error} />;

  return <div>{user.name}</div>;
}
Follow Hook Rules
Always follow the Rules of Hooks: only call hooks at the top level of functions and only from React functions or custom hooks.
// ❌ Bad: Conditional hook usage
function MyComponent({ shouldFetch }) {
  if (shouldFetch) {
    const data = useFetch('/api/data'); // Violates rules of hooks
  }
}

// ✅ Good: Hooks at top level
function MyComponent({ shouldFetch }) {
  const data = useFetch(shouldFetch ? '/api/data' : null);
}

Error Handling:

Implement Error Boundaries
Error boundaries catch JavaScript errors in component trees and display fallback UIs instead of crashing the entire application.
class ErrorBoundary extends Component {
  constructor(props) {
    super(props);
    this.state = { hasError: false };
  }

  static getDerivedStateFromError(error) {
    return { hasError: true };
  }

  componentDidCatch(error, errorInfo) {
    console.error('Error caught by boundary:', error, errorInfo);
  }

  render() {
    if (this.state.hasError) {
      return <h1>Something went wrong.</h1>;
    }

    return this.props.children;
  }
}

// Usage
function App() {
  return (
    <ErrorBoundary>
      <UserDashboard />
    </ErrorBoundary>
  );
}
Handle Async Errors Gracefully
Always handle potential errors in async operations and provide meaningful feedback to users.
function DataComponent() {
  const [data, setData] = useState(null);
  const [error, setError] = useState(null);

  useEffect(() => {
    fetchData()
      .then(setData)
      .catch(err => {
        setError('Failed to load data. Please try again.');
        console.error(err);
      });
  }, []);

  if (error) {
    return <div className="error">{error}</div>;
  }

  return data ? <DataDisplay data={data} /> : <Loading />;
}

Code Organization and Structure:

Use Consistent File Structure
Organize your files in a logical, consistent manner. Group related files together and use clear naming conventions.












Use TypeScript for Better Development Experience
TypeScript provides excellent developer experience with better autocomplete, refactoring support, and catch errors at compile time.
interface User {
  id: string;
  name: string;
  email: string;
}

interface UserProfileProps {
  user: User;
  onEdit: (user: User) => void;
}

function UserProfile({ user, onEdit }: UserProfileProps) {
  return (
    <div>
      <h2>{user.name}</h2>
      <button onClick={() => onEdit(user)}>
        Edit Profile
      </button>
    </div>
  );
}

Accessibility:

Make Your Apps Inclusive
Always consider accessibility when building React components. Use semantic HTML, proper ARIA attributes, and ensure keyboard navigation works.
function Modal({ isOpen, onClose, title, children }) {
  useEffect(() => {
    if (isOpen) {
      document.body.style.overflow = 'hidden';
    }
    return () => {
      document.body.style.overflow = 'unset';
    };
  }, [isOpen]);

  if (!isOpen) return null;

  return (
    <div 
      className="modal-overlay" 
      onClick={onClose}
      role="dialog"
      aria-modal="true"
      aria-labelledby="modal-title"
    >
      <div className="modal-content" onClick={e => e.stopPropagation()}>
        <h2 id="modal-title">{title}</h2>
        <button 
          onClick={onClose}
          aria-label="Close modal"
          className="close-button"
        >
          ×
        </button>
        {children}
      </div>
    </div>
  );
}

Key Takeaways:

Following these React best practices will help you build applications that are:
  • Maintainable: Clean, organized code that's easy to update and extend
  • Performant: Optimized components that render efficiently
  • Accessible: Inclusive applications that work for all users
  • Scalable: Architecture that grows well with your application's needs
Remember, best practices evolve with the React ecosystem. Stay updated with the latest React documentation, follow the community discussions, and always consider the specific needs of your project when applying these guidelines. The goal is to write code that not only works today but remains maintainable and performant as your application grows.

If you have any questions you can reach out our SharePoint Consulting team here.