Skip to content

Commit

Permalink
AD-274 Browser console error Cannot read properties of null (reading …
Browse files Browse the repository at this point in the history
…'getAttribute')
  • Loading branch information
pjaneta committed Aug 21, 2024
1 parent 7e8a9c4 commit dfc0be7
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,21 @@ import {RouterProvider} from "react-router-dom";
import {router} from "./router/router"


const root = ReactDOM.createRoot(document.getElementById('root'));
root.render(
<React.StrictMode>
<Provider store={store}>
const rootElement = document.getElementById('root');

if (rootElement) {
const root = ReactDOM.createRoot(rootElement);
root.render(
<React.StrictMode>
<Provider store={store}>
<RouterProvider router={router}/>
</Provider>
</React.StrictMode>
);
</Provider>
</React.StrictMode>
);

// If you want to start measuring performance in your app, pass a function
// to log results (for example: reportWebVitals(console.log))
// or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals
reportWebVitals();
}

// If you want to start measuring performance in your app, pass a function
// to log results (for example: reportWebVitals(console.log))
// or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals
reportWebVitals();
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ declare var ACC: any;
export const urlContextPath: string = ACC.config.encodedContextPath

const rootElement = document.getElementById('root');
export const CSRFToken = rootElement.getAttribute('csrf-token');
export const CSRFToken = rootElement ? rootElement.getAttribute('csrf-token') : undefined;

0 comments on commit dfc0be7

Please sign in to comment.