How to use the react-id-generator function in react-id-generator

To help you get started, we’ve selected a few react-id-generator examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github goiblas / personal-blog / packages / goiblas-blog / src / components / list / list-item.js View on Github external
const Item = ({ state, item }) => {

  const { author } = state.frontity;
  const date = new Date(item.date);
  const dateFormatted = `${date.getDate()} / ${date.getMonth()} / ${date.getFullYear()}`

  const excerptWithoutParragraph = item.excerpt.rendered.replace(/<\/?p>/g,''); 
  const excerptPlain = excerptWithoutParragraph.replace('[…]', '… '); 
  
  const titleId  = nextId('title-');
  const readmoreId  = nextId('readmore-');

  return (
    <article>
      
        <title id="{titleId}">
      &lt;/Link&gt;
      &lt;Postdetails&gt;
        &lt;DateFormat date={item.date} /&gt;
      &lt;/Postdetails&gt;
      &lt;p&gt;
        &lt;span dangerouslySetInnerHTML={{__html: excerptPlain} } /&gt;
        &lt;Link link={item.link} id={readmoreId} ariaLabelledby={readmoreId + ' ' + titleId }&gt;Leer&nbsp;más&lt;/Link&gt;
      &lt;/p&gt;
    &lt;/Article&gt;
  );
};</title></article>
github goiblas / personal-blog / packages / goiblas-blog / src / components / list / list-item.js View on Github external
const Item = ({ state, item }) =&gt; {

  const { author } = state.frontity;
  const date = new Date(item.date);
  const dateFormatted = `${date.getDate()} / ${date.getMonth()} / ${date.getFullYear()}`

  const excerptWithoutParragraph = item.excerpt.rendered.replace(/&lt;\/?p&gt;/g,''); 
  const excerptPlain = excerptWithoutParragraph.replace('[…]', '… '); 
  
  const titleId  = nextId('title-');
  const readmoreId  = nextId('readmore-');

  return (
    <article>
      
        <title id="{titleId}">
      &lt;/Link&gt;
      &lt;Postdetails&gt;
        &lt;DateFormat date={item.date} /&gt;
      &lt;/Postdetails&gt;
      &lt;p&gt;
        &lt;span dangerouslySetInnerHTML={{__html: excerptPlain} } /&gt;
        &lt;Link link={item.link} id={readmoreId} ariaLabelledby={readmoreId + ' ' + titleId }&gt;Leer&nbsp;más&lt;/Link&gt;
      &lt;/p&gt;
    &lt;/Article&gt;
  );</title></article>

react-id-generator

Simple and universal HTML-id generator for React.

MIT
Latest version published 3 years ago

Package Health Score

47 / 100
Full package analysis

Popular react-id-generator functions