0.1.14 • Published 1 year ago

react-native-mfe v0.1.14

Weekly downloads
-
License
ISC
Repository
-
Last release
1 year ago

Lib to help integrations with Micro-FrontEnds(MFE) that use react-native-webview.

Installing

Using yarn:

$ yarn add react-native-mfe

Using EXPO:

$ expo add react-native-mfe

Example

Usage:

import React, { useRef } from 'react';
import { Mfe, EventReturnTypes, MfeRefTypes } from 'react-native-mfe';

export function App() {
	const mfeRef = useRef<MfeRefTypes>();

	return(
		<Mfe
			ref={mfeRef}
			url="https://mfe.ffit.com.br/v1/mfe/{{name}}" 
			params={{ // MFE params
				type: 'test',
				isMobile: true,
			}}
			onEvent={(data: EventReturnTypes) => {
				if (data.event === 'receivedEvent') {
					// Add logic to use info

					// Example of sending an event back to mfe
					setTimeout(() => {
					if (mfeRef.current)
						mfeRef.current.sendEvent({ event: "updateInfo", info: { param: "TEST!"}});
					}, 5000)
				}
			}}
		/>
	)
}

Props

Proptypedescription
urlstringThe url of the Micro-Frontend (MFE)
paramsobjectThe params that should be sent as query params to the MFE
onEventfunctionFunction that was called when the MFE sends an Event
0.1.14

1 year ago

0.1.13

1 year ago

0.1.12

1 year ago

0.1.10

2 years ago

0.1.11

2 years ago

0.1.2

2 years ago

0.1.1

2 years ago

0.1.8

2 years ago

0.1.7

2 years ago

0.1.9

2 years ago

0.1.4

2 years ago

0.1.3

2 years ago

0.1.6

2 years ago

0.1.5

2 years ago

0.0.14

2 years ago

0.1.0

2 years ago

0.0.10

3 years ago

0.0.11

3 years ago

0.0.12

2 years ago

0.0.13

2 years ago

0.0.9

3 years ago

0.0.8

3 years ago

0.0.7

3 years ago

0.0.6

3 years ago

0.0.5

3 years ago

0.0.4

3 years ago

0.0.3

3 years ago

0.0.2

3 years ago

0.0.1

3 years ago