: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in
: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in
import React from 'react';
import { createRoot } from 'react-dom/client';
import domReady from '@wordpress/dom-ready';
import StepsBar from '../views/webp/steps-bar';
import StepContent from '../views/webp/step-content';
import FreeContent from '../views/webp/free-content';
import StepFooter from '../views/webp/step-footer';
export const WebpPage = ({ smushData }) => {
const [currentStep, setCurrentStep] = React.useState(
parseInt(smushData.startStep)
window.SUI.suiCodeSnippet();
const [serverType, setServerType] = React.useState(
const [rulesMethod, setRulesMethod] = React.useState('automatic');
const [rulesError, setRulesError] = React.useState(false);
const makeRequest = (action, verb = 'GET') => {
return new Promise((resolve, reject) => {
const xhr = new XMLHttpRequest();
`${ajaxurl}?action=${action}&_ajax_nonce=${smushData.nonce}`,
'application/x-www-form-urlencoded'
if (xhr.status >= 200 && xhr.status < 300) {
resolve(JSON.parse(xhr.response));
xhr.onerror = () => reject(xhr);
const stepContent = smushData.isPro ? (
currentStep={currentStep}
rulesMethod={rulesMethod}
setRulesMethod={setRulesMethod}
setServerType={setServerType}
makeRequest={makeRequest}
<FreeContent smushData={smushData} />
<div className="sui-box-body sui-no-padding">
<div className="sui-row-with-sidenav">
{ smushData.isPro && <StepsBar smushData={smushData} currentStep={currentStep} /> }
currentStep={currentStep}
setCurrentStep={setCurrentStep}
rulesMethod={rulesMethod}
setRulesError={setRulesError}
makeRequest={makeRequest}
const webpPageBox = document.getElementById('smush-box-webp-wizard');
const root = createRoot(webpPageBox);
root.render( <WebpPage smushData={window.smushReact} /> );