Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

reactt split a value and sepate

state = {
   codes : {
    first: "test-123",
    second: "second-6" ,
    seconds: "bet-80",
    days: "4-7"
   }
  }
  render(){
    const {codes} = this.state
    let first,second
    const render =  Object.keys(codes).map((key) => [
    <>
    <label>{key} </label> 
    <label>{first = codes[key].split('-')[0]}</label> 
    <label>{second = codes[key].split('-')[1]}</label> 
    </>
    ])

  return (
    
  <>{render}</>
  );
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #reactt #split #sepate
ADD COMMENT
Topic
Name
3+9 =