MML React is a library from GetStream for rendering Message Markup Language (MML) content within React applications. It provides a foundational `<MML />` component that parses MML strings and translates them into corresponding React components for display. The library is currently stable at version `0.4.7` and has seen a series of maintenance and dependency updates, particularly around early 2022, though new feature releases appear less frequent. Key differentiators include its tight integration with the GetStream ecosystem for building rich chat UIs, extensive customization options for overriding default MML tag-to-React component mappings, and a flexible theming system using SCSS variables. It abstracts away the complexity of parsing and rendering structured message content, offering a component-based approach to build interactive and styled UI elements.
npm install mml-reactVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to render dynamic MML content using the `<MML />` component. It includes an editable textarea to update the MML source live and showcases how to override a default MML tag (like 'button') with a custom React component using the `converters` prop.
Review `react-virtuoso` v1 changelog and test MML components that involve virtualized lists. Adjust any custom styling or logic if necessary.
Thoroughly test existing MML content for any parsing regressions. Ensure MML source strings strictly adhere to valid XML/MML syntax.
Upgrade `mml-react` to at least `v0.4.6` or later when using React v18 to ensure peer dependency compatibility and proper functionality.
Verify that all URLs within your MML content are correctly sanitized and rendered after the upgrade. Check for any URLs that might now be unexpectedly blocked or modified.
Immediately upgrade to `mml-react` version `0.4.2` or later to mitigate this security vulnerability.
Run `npm install mml-react` or `yarn add mml-react`. Ensure your import statement is `import { MML } from 'mml-react';`.Ensure `MML` is imported as a named export (`import { MML } from 'mml-react';`) and used as a JSX component: `<MML source="<mml>...</mml>" />`.Review the `mmlContent` or `source` prop string for well-formed XML structure. Ensure all tags are properly closed, attributes are quoted, and the overall MML conforms to the expected specification.
Ensure the `converters` prop is an object where keys are MML tag names (e.g., `'button'`) and values are functions that accept `tag` and `children` arguments and return a React element.