Security News
JSR Working Group Kicks Off with Ambitious Roadmap and Plans for Open Governance
At its inaugural meeting, the JSR Working Group outlined plans for an open governance model and a roadmap to enhance JavaScript package management.
@fluentui/react-jsx-runtime
Advanced tools
Custom JSX runtime for @fluentui/react-components
React JSX runtime for Fluent UI React
Fluent UI React requires the usage of a custom JSX runtime to support the slots API
This library should only be used in the case where you are trying to use the internal slot API of Fluent UI React. If you are not using the internal slot API, you should not need to use this library.
In case you want to re-compose a component and redeclare its render method then this API will be necessary, here's our documentation on Rendering a component with slots
To properly render a component with slots the createElement
method of @fluentui/react-jsx-runtime
can be used as a replacement for React.createElement
:
/** @jsxRuntime classic */
/** @jsx createElement */
// createElement custom JSX pragma is required to support slot creation
import { createElement } from '@fluentui/react-jsx-runtime';
import { assertSlots } from '@fluentui/react-utilities';
const renderButton_unstable = (state: ButtonState) => {
const { iconOnly, iconPosition } = state;
assertSlots<ButtonSlots>(state);
return (
<state.root>
{iconPosition !== 'after' && state.icon && <state.icon />}
{!iconOnly && state.root.children}
{iconPosition === 'after' && state.icon && <state.icon />}
</state.root>
);
};
In case you're using typescript or any modern javascript transpiler, you can use JSX import source feature instead of depending on declaring the runtime on every file
In TSC case you can simply add this do tsconfig.json
file:
{
"compilerOptions": {
"jsx": "react-jsx",
"jsxImportSource": "@fluentui/react-jsx-runtime"
}
}
FAQs
Custom JSX runtime for @fluentui/react-components
The npm package @fluentui/react-jsx-runtime receives a total of 89,599 weekly downloads. As such, @fluentui/react-jsx-runtime popularity was classified as popular.
We found that @fluentui/react-jsx-runtime demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 12 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
At its inaugural meeting, the JSR Working Group outlined plans for an open governance model and a roadmap to enhance JavaScript package management.
Security News
Research
An advanced npm supply chain attack is leveraging Ethereum smart contracts for decentralized, persistent malware control, evading traditional defenses.
Security News
Research
Attackers are impersonating Sindre Sorhus on npm with a fake 'chalk-node' package containing a malicious backdoor to compromise developers' projects.