
Security News
Axios Supply Chain Attack Reaches OpenAI macOS Signing Pipeline, Forces Certificate Rotation
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.
react-teirouter
Advanced tools
Render TEI files intuitively in React.js using custom routes for TEI elements.
The main components TEIRender takes in a DOM object and custom routes can be defined to attach components
to elements in the DOM by name.
For TEI rendering we recommend generating the DOM Object with CETEIcean. See the example in examples/ceteicean.js for usage.
const domData // a DOM object, e.g. generated with CETEIcean.
<TEIRender data={domData}>
<TEIRoute el='tei-teiheader' component={Header}/>
<TEIRoute el='tei-notatedmusic' component={NotatedMusic}/>
<TEIRoute el='tei-media' component={Media}/>
<TEIRoute el='tei-ref' component={Reference}/>
<TEIRoute el='tei-persname'>
<LinkToIndex type='indexOfPersons'/>
</TEIRoute>
</TEIRender>
Now custom components ("routes") can be defined for teiHeader, notatedMusic, media etc., for example:
const Reference = (props) => {
const target = props.teiNode.getAttribute('target')
return (
<Link to={target}>
{props.children}
</Link>
)
}
To continue applying routes to children, the API exposes TEINode for single nodes and TEINodes for DOM NodeLists.
Make sure to pass the rest of the properties to keep applying routes to children nodes.
const Reference = (props) => {
const target = props.teiNode.getAttribute('target')
return (
<Link to={target}>
{<TEINodes teiNodes={props.teiNode.childNodes} {...props} />}
</Link>
)
}
It is also possible to specify a route to match text nodes using the keyword text():
<TEIRoute el='text()' component={TextNodeHandler}/>
FAQs
TEI for React
We found that react-teirouter demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.

Security News
Open source is under attack because of how much value it creates. It has been the foundation of every major software innovation for the last three decades. This is not the time to walk away from it.

Security News
Socket CEO Feross Aboukhadijeh breaks down how North Korea hijacked Axios and what it means for the future of software supply chain security.